Magento Asked by Ramesh on December 29, 2020
How can i get the admin session in frontend.
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$adminSession = $objectManager->create('MagentoSecurityModelAdminSessionsManager');
print_r($adminSession->getCurrentSession()->getStatus());
I tried with above script but no luck
protected $_session;
public function __construct(
MagentoFrameworkModelContext $context,
MagentoBackendModelAuthSession $authSession
) {
$this->_session = $authSession;
parent::__construct($context);
}
and then call
$this->_session->isLoggedIn()
Note: don't use objectManager
. Its not proper way to do it in Magento 2
Answered by Abhishek Panchal on December 29, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP