Get admin detail via load by user_id in magento 2Magento 2 - How to get admin user role?How to Copy Code/Core system.xml file into Code/local in magentoadd attribute to admin userAdding a grid/table inside grid in Magento Admincustomer registartion success mail change via admin paneladmin last login detailShows “SQLSTATE[42S02]: Base table or view not found----” when I try to access the customer details in admin panelMagento 2: How to get admin user detail load by id?Categories in the Admin panel do not load-ERR (3):Warning:simplexml_load_string():Entity:line9:parser error:Premature end of data in tag config line2User Access PermissionMagento admin url does not load

Is it legal for company to use my work email to pretend I still work there?

Why don't electron-positron collisions release infinite energy?

What does "Puller Prush Person" mean?

Risk of getting Chronic Wasting Disease (CWD) in the United States?

How do we improve the relationship with a client software team that performs poorly and is becoming less collaborative?

TGV timetables / schedules?

Minkowski space

Mathematical cryptic clues

What typically incentivizes a professor to change jobs to a lower ranking university?

What is the word for reserving something for yourself before others do?

Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?

Why do falling prices hurt debtors?

Why was the small council so happy for Tyrion to become the Master of Coin?

Why are 150k or 200k jobs considered good when there are 300k+ births a month?

Which models of the Boeing 737 are still in production?

Is it unprofessional to ask if a job posting on GlassDoor is real?

"to be prejudice towards/against someone" vs "to be prejudiced against/towards someone"

Are the number of citations and number of published articles the most important criteria for a tenure promotion?

How does strength of boric acid solution increase in presence of salicylic acid?

How to write a macro that is braces sensitive?

Python: next in for loop

How is it possible to have an ability score that is less than 3?

Theorems that impeded progress

How to format long polynomial?



Get admin detail via load by user_id in magento 2


Magento 2 - How to get admin user role?How to Copy Code/Core system.xml file into Code/local in magentoadd attribute to admin userAdding a grid/table inside grid in Magento Admincustomer registartion success mail change via admin paneladmin last login detailShows “SQLSTATE[42S02]: Base table or view not found----” when I try to access the customer details in admin panelMagento 2: How to get admin user detail load by id?Categories in the Admin panel do not load-ERR (3):Warning:simplexml_load_string():Entity:line9:parser error:Premature end of data in tag config line2User Access PermissionMagento admin url does not load






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















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);


this code for magento1 . am working on magento 2 . can anyone guide me how get user detail of specific user_id.










share|improve this question






















  • please try : magento.stackexchange.com/questions/103582/… OR webkul.com/blog/…

    – Pawan
    Apr 4 at 2:15

















2















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);


this code for magento1 . am working on magento 2 . can anyone guide me how get user detail of specific user_id.










share|improve this question






















  • please try : magento.stackexchange.com/questions/103582/… OR webkul.com/blog/…

    – Pawan
    Apr 4 at 2:15













2












2








2


0






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);


this code for magento1 . am working on magento 2 . can anyone guide me how get user detail of specific user_id.










share|improve this question














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);


this code for magento1 . am working on magento 2 . can anyone guide me how get user detail of specific user_id.







admin email






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 3 at 21:05









HaFiz UmerHaFiz Umer

4149




4149












  • please try : magento.stackexchange.com/questions/103582/… OR webkul.com/blog/…

    – Pawan
    Apr 4 at 2:15

















  • please try : magento.stackexchange.com/questions/103582/… OR webkul.com/blog/…

    – Pawan
    Apr 4 at 2:15
















please try : magento.stackexchange.com/questions/103582/… OR webkul.com/blog/…

– Pawan
Apr 4 at 2:15





please try : magento.stackexchange.com/questions/103582/… OR webkul.com/blog/…

– Pawan
Apr 4 at 2:15










1 Answer
1






active

oldest

votes


















2














In Magento 2 you can do it by instantiating model object using dependency injection to inject its factory object. Please refer to this article, Factory Object for model in Magento 2, to understand more.



Check code below:



/** @var MagentoUserModelUserFactory */
protected $userFactory;

/**
* constructor.
* @param MagentoUserModelUserFactory $userFactory
*/
public function __construct(
MagentoUserModelUserFactory $userFactory
)

$this->userFactory = $userFactory;



In your public method you can get admin detail like this:



public function getAdminDetails()

//By username get admin User's Details
$username = 'admin';
$user = $this->userFactory->create()->loadByUsername($username);
$user->getStoredData();
//get specific data like username
//$user->getUserName();
var_dump($user);

//By id get admin User's Details
$id = 1;
$user = $this->userFactory->create()->load($id);
$user->getStoredData();
//get specific data like username
//$user->getUserName();
var_dump($user);







share|improve this answer























  • ! sorry is not work . i create log. and check dubug.log . return null

    – HaFiz Umer
    2 days ago











  • try to change line var_dump($user); to return print_r($user);

    – magefms
    2 days ago






  • 1





    please it $userid=28; $userdetail=$this->userFactory->create()->load($userid); $this->logger->debug(' User Email is '.$userdetail->getEmail()); in debug.log file main.DEBUG: User Email is [] [] null value return. i also try loadByUsername($username) but nor work.

    – HaFiz Umer
    2 days ago






  • 1





    not i don't run upgrade. let me run then i will . actually var_dump or print_r() is not work because i work on place order event fire

    – HaFiz Umer
    2 days ago






  • 1





    Yes it work thanks

    – HaFiz Umer
    2 days ago











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268638%2fget-admin-detail-via-load-by-user-id-in-magento-2%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














In Magento 2 you can do it by instantiating model object using dependency injection to inject its factory object. Please refer to this article, Factory Object for model in Magento 2, to understand more.



Check code below:



/** @var MagentoUserModelUserFactory */
protected $userFactory;

/**
* constructor.
* @param MagentoUserModelUserFactory $userFactory
*/
public function __construct(
MagentoUserModelUserFactory $userFactory
)

$this->userFactory = $userFactory;



In your public method you can get admin detail like this:



public function getAdminDetails()

//By username get admin User's Details
$username = 'admin';
$user = $this->userFactory->create()->loadByUsername($username);
$user->getStoredData();
//get specific data like username
//$user->getUserName();
var_dump($user);

//By id get admin User's Details
$id = 1;
$user = $this->userFactory->create()->load($id);
$user->getStoredData();
//get specific data like username
//$user->getUserName();
var_dump($user);







share|improve this answer























  • ! sorry is not work . i create log. and check dubug.log . return null

    – HaFiz Umer
    2 days ago











  • try to change line var_dump($user); to return print_r($user);

    – magefms
    2 days ago






  • 1





    please it $userid=28; $userdetail=$this->userFactory->create()->load($userid); $this->logger->debug(' User Email is '.$userdetail->getEmail()); in debug.log file main.DEBUG: User Email is [] [] null value return. i also try loadByUsername($username) but nor work.

    – HaFiz Umer
    2 days ago






  • 1





    not i don't run upgrade. let me run then i will . actually var_dump or print_r() is not work because i work on place order event fire

    – HaFiz Umer
    2 days ago






  • 1





    Yes it work thanks

    – HaFiz Umer
    2 days ago















2














In Magento 2 you can do it by instantiating model object using dependency injection to inject its factory object. Please refer to this article, Factory Object for model in Magento 2, to understand more.



Check code below:



/** @var MagentoUserModelUserFactory */
protected $userFactory;

/**
* constructor.
* @param MagentoUserModelUserFactory $userFactory
*/
public function __construct(
MagentoUserModelUserFactory $userFactory
)

$this->userFactory = $userFactory;



In your public method you can get admin detail like this:



public function getAdminDetails()

//By username get admin User's Details
$username = 'admin';
$user = $this->userFactory->create()->loadByUsername($username);
$user->getStoredData();
//get specific data like username
//$user->getUserName();
var_dump($user);

//By id get admin User's Details
$id = 1;
$user = $this->userFactory->create()->load($id);
$user->getStoredData();
//get specific data like username
//$user->getUserName();
var_dump($user);







share|improve this answer























  • ! sorry is not work . i create log. and check dubug.log . return null

    – HaFiz Umer
    2 days ago











  • try to change line var_dump($user); to return print_r($user);

    – magefms
    2 days ago






  • 1





    please it $userid=28; $userdetail=$this->userFactory->create()->load($userid); $this->logger->debug(' User Email is '.$userdetail->getEmail()); in debug.log file main.DEBUG: User Email is [] [] null value return. i also try loadByUsername($username) but nor work.

    – HaFiz Umer
    2 days ago






  • 1





    not i don't run upgrade. let me run then i will . actually var_dump or print_r() is not work because i work on place order event fire

    – HaFiz Umer
    2 days ago






  • 1





    Yes it work thanks

    – HaFiz Umer
    2 days ago













2












2








2







In Magento 2 you can do it by instantiating model object using dependency injection to inject its factory object. Please refer to this article, Factory Object for model in Magento 2, to understand more.



Check code below:



/** @var MagentoUserModelUserFactory */
protected $userFactory;

/**
* constructor.
* @param MagentoUserModelUserFactory $userFactory
*/
public function __construct(
MagentoUserModelUserFactory $userFactory
)

$this->userFactory = $userFactory;



In your public method you can get admin detail like this:



public function getAdminDetails()

//By username get admin User's Details
$username = 'admin';
$user = $this->userFactory->create()->loadByUsername($username);
$user->getStoredData();
//get specific data like username
//$user->getUserName();
var_dump($user);

//By id get admin User's Details
$id = 1;
$user = $this->userFactory->create()->load($id);
$user->getStoredData();
//get specific data like username
//$user->getUserName();
var_dump($user);







share|improve this answer













In Magento 2 you can do it by instantiating model object using dependency injection to inject its factory object. Please refer to this article, Factory Object for model in Magento 2, to understand more.



Check code below:



/** @var MagentoUserModelUserFactory */
protected $userFactory;

/**
* constructor.
* @param MagentoUserModelUserFactory $userFactory
*/
public function __construct(
MagentoUserModelUserFactory $userFactory
)

$this->userFactory = $userFactory;



In your public method you can get admin detail like this:



public function getAdminDetails()

//By username get admin User's Details
$username = 'admin';
$user = $this->userFactory->create()->loadByUsername($username);
$user->getStoredData();
//get specific data like username
//$user->getUserName();
var_dump($user);

//By id get admin User's Details
$id = 1;
$user = $this->userFactory->create()->load($id);
$user->getStoredData();
//get specific data like username
//$user->getUserName();
var_dump($user);








share|improve this answer












share|improve this answer



share|improve this answer










answered Apr 4 at 3:46









magefmsmagefms

2,4312426




2,4312426












  • ! sorry is not work . i create log. and check dubug.log . return null

    – HaFiz Umer
    2 days ago











  • try to change line var_dump($user); to return print_r($user);

    – magefms
    2 days ago






  • 1





    please it $userid=28; $userdetail=$this->userFactory->create()->load($userid); $this->logger->debug(' User Email is '.$userdetail->getEmail()); in debug.log file main.DEBUG: User Email is [] [] null value return. i also try loadByUsername($username) but nor work.

    – HaFiz Umer
    2 days ago






  • 1





    not i don't run upgrade. let me run then i will . actually var_dump or print_r() is not work because i work on place order event fire

    – HaFiz Umer
    2 days ago






  • 1





    Yes it work thanks

    – HaFiz Umer
    2 days ago

















  • ! sorry is not work . i create log. and check dubug.log . return null

    – HaFiz Umer
    2 days ago











  • try to change line var_dump($user); to return print_r($user);

    – magefms
    2 days ago






  • 1





    please it $userid=28; $userdetail=$this->userFactory->create()->load($userid); $this->logger->debug(' User Email is '.$userdetail->getEmail()); in debug.log file main.DEBUG: User Email is [] [] null value return. i also try loadByUsername($username) but nor work.

    – HaFiz Umer
    2 days ago






  • 1





    not i don't run upgrade. let me run then i will . actually var_dump or print_r() is not work because i work on place order event fire

    – HaFiz Umer
    2 days ago






  • 1





    Yes it work thanks

    – HaFiz Umer
    2 days ago
















! sorry is not work . i create log. and check dubug.log . return null

– HaFiz Umer
2 days ago





! sorry is not work . i create log. and check dubug.log . return null

– HaFiz Umer
2 days ago













try to change line var_dump($user); to return print_r($user);

– magefms
2 days ago





try to change line var_dump($user); to return print_r($user);

– magefms
2 days ago




1




1





please it $userid=28; $userdetail=$this->userFactory->create()->load($userid); $this->logger->debug(' User Email is '.$userdetail->getEmail()); in debug.log file main.DEBUG: User Email is [] [] null value return. i also try loadByUsername($username) but nor work.

– HaFiz Umer
2 days ago





please it $userid=28; $userdetail=$this->userFactory->create()->load($userid); $this->logger->debug(' User Email is '.$userdetail->getEmail()); in debug.log file main.DEBUG: User Email is [] [] null value return. i also try loadByUsername($username) but nor work.

– HaFiz Umer
2 days ago




1




1





not i don't run upgrade. let me run then i will . actually var_dump or print_r() is not work because i work on place order event fire

– HaFiz Umer
2 days ago





not i don't run upgrade. let me run then i will . actually var_dump or print_r() is not work because i work on place order event fire

– HaFiz Umer
2 days ago




1




1





Yes it work thanks

– HaFiz Umer
2 days ago





Yes it work thanks

– HaFiz Umer
2 days ago

















draft saved

draft discarded
















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268638%2fget-admin-detail-via-load-by-user-id-in-magento-2%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Sum ergo cogito? 1 nng

419 nièngy_Soadمي 19bal1.5o_g

Queiggey Chernihivv 9NnOo i Zw X QqKk LpB