Skip to main content
Commonmark migration
Source Link

I have a magento installation I want to access the logged in admin credentials in a file inside a subfolder. I make a file and keep it in the root (the same folder where the magento index.php resides). It shows me the logged in user data perfectly. Now when I copy the same file inside a subfolder it returns the data but the data array(which contains the loggedin user information) is empty. Below is the code

require_once ('app/Mage.php');

 

Mage::app();

 

$user = Mage::getSingleton('admin/session');

 

print_r($user);

I have a magento installation I want to access the logged in admin credentials in a file inside a subfolder. I make a file and keep it in the root (the same folder where the magento index.php resides). It shows me the logged in user data perfectly. Now when I copy the same file inside a subfolder it returns the data but the data array(which contains the loggedin user information) is empty. Below is the code

require_once ('app/Mage.php');

 

Mage::app();

 

$user = Mage::getSingleton('admin/session');

 

print_r($user);

I have a magento installation I want to access the logged in admin credentials in a file inside a subfolder. I make a file and keep it in the root (the same folder where the magento index.php resides). It shows me the logged in user data perfectly. Now when I copy the same file inside a subfolder it returns the data but the data array(which contains the loggedin user information) is empty. Below is the code

require_once ('app/Mage.php');

Mage::app();

$user = Mage::getSingleton('admin/session');

print_r($user);

Source Link
AbdulBasit
  • 438
  • 4
  • 14

Accessing Magento admin cookie in a custom file inside a folder

I have a magento installation I want to access the logged in admin credentials in a file inside a subfolder. I make a file and keep it in the root (the same folder where the magento index.php resides). It shows me the logged in user data perfectly. Now when I copy the same file inside a subfolder it returns the data but the data array(which contains the loggedin user information) is empty. Below is the code

require_once ('app/Mage.php');

Mage::app();

$user = Mage::getSingleton('admin/session');

print_r($user);