Reading list Switch to dark mode

    Create Admin User Pragmatically in Magento

    Updated 23 February 2024

    $user = Mage::getModel('admin/user')
    		->setData(array(
    			'username'  =>'username',
    			'firstname' => 'firstname',
    			'lastname'  => 'lastname',
    			'email'     => '[email protected]',
    			'password'  => 'loginpwd',
    			'is_active' => 1
    		))->save();
    $user->setRoleIds(array(3))   //here 3 is Role Id that assign to this user
    	->setRoleUserId($user->getUserId())
    	->saveRelations();

    Searching for an experienced
    Magento Company ?
    Find out More
    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home