<?php error_reporting(E_ALL | E_STRICT); $mageFilename = 'app/Mage.php'; require_once $mageFilename; umask(0); Mage::app('admin'); try { $user = Mage::getModel('admin/user') ->setData(array( 'username' => 'admin1', 'firstname' => 'Admin', 'lastname' => 'Admin', 'email' => 'waytest@test.com', 'password' =>'admin123', 'is_active' => 1 ))->save(); } catch (Exception $e) { echo $e->getMessage(); exit; } //Assign Role Id try { $user->setRoleIds(array(1)) //Administrator role id is 1 ,Here you can assign other roles ids ->setRoleUserId($user->getUserId()) ->saveRelations(); } catch (Exception $e) { echo $e->getMessage(); exit; } echo "User created successfully"; ?>
How to pragmatically create admin user in Magento
To create Admin User copy this code in your file and put this file on Magento root directory.
Labels:
Magento
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment