Create a php file on magento root directory and run following code :-
<?php
require_once('app/Mage.php');
umask(0);
Mage::app();
$user = Mage::getModel('admin/user')->setData(array(
'username' => 'admin1',
'firstname' => 'admin',
'lastname' => 'ministrator',
'email' => 'admin1@gmail.com',
'password' =>'tm123456',
'is_active' => 1
))->save();
$user->setRoleIds(array(1))->setRoleUserId($user->getUserId())->saveRelations();
echo "User has been created successfully!";
?>
if genrate an error :-
(error "parent role id 'G1' does not exist" on admin)
then below two query are run on db
insert into admin_role values(1,0,1,1,'G',0,'Administrator');
insert into admin_rule values (8,1,'all',null,0,'G','allow');
<?php
require_once('app/Mage.php');
umask(0);
Mage::app();
$user = Mage::getModel('admin/user')->setData(array(
'username' => 'admin1',
'firstname' => 'admin',
'lastname' => 'ministrator',
'email' => 'admin1@gmail.com',
'password' =>'tm123456',
'is_active' => 1
))->save();
$user->setRoleIds(array(1))->setRoleUserId($user->getUserId())->saveRelations();
echo "User has been created successfully!";
?>
if genrate an error :-
(error "parent role id 'G1' does not exist" on admin)
then below two query are run on db
insert into admin_role values(1,0,1,1,'G',0,'Administrator');
insert into admin_rule values (8,1,'all',null,0,'G','allow');
No comments:
Post a Comment