Posted by salimmohd82 on December 28, 2012 at 10:55am
I tried to execute this code from hook_user_login
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/mage1/app/Mage.php";
umask(0);
Mage::App('default');
$session = Mage::getSingleton('customer/session', array('name' => 'frontend'));
try {
$session->login('alvaro@test.com', 'cec123');
$session->setCustomerAsLoggedIn($session->getCustomer());
header('Location: http://'.$_SERVER[SERVER_NAME].'/mage1/customer/account/?SID='.$session->getSessionId());
} catch (Exception $e) {
print_r($e);
exit;
}
?>But not able to log-in to magento and it automatically logs out of Drupal.
But if i run this code separately in a simple php page it logs into magento
I user D7 and Mage 1.7