0

I want to get magento admin users and assign them a mobile number, from each particular agent panel, agent can able make a call from that number.

1 Answer 1

1

To get Users

<?php
//By Username get admin User's Details
$username = 'admin';
$user_data = Mage::getModel('admin/user')->getCollection()->addFieldToFilter('username',$username)->getData();
var_dump($user_data);

//By Username get admin User's Role Details
$username = 'admin';
$role_data = Mage::getModel('admin/user')->getCollection()->addFieldToFilter('username',$username)->getFirstItem()->getRole()->getData();
var_dump($role_data);

//By ID get admin User's Details
$id = 1;
$user_data = Mage::getModel('admin/user')->load($id)->getData();
var_dump($user_data);


//By ID get admin User's Role Details
$id = 1;
$role_data = Mage::getModel('admin/user')->load($id)->getRole()->getData();
var_dump($role_data);

To change or update user details, you can follow the given code

$user = Mage::getModel('admin/user')->load($userId);
        $user->setIsActive(1)
        ->save();

in the above code, you can use your field name which you want to update

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.