Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Customer login from another site in same domain doesn’t work
 
loxone_magento
Jr. Member
 
Total Posts:  13
Joined:  2013-03-19
 

Dear Community,

i have waisted lot of time, but i have no progress with this issue. I want to log myself, in a content-management-system and then be also logged in in magento. I have tried everything and the code should work, but it doesn’t.

Mage::init();

$session = Mage::getSingleton(’customer/session’);

$db_read = Mage::getSingleton(’core/resource’)->getConnection(’core_read’);
$tablePrefix = (string) Mage::getConfig()->getTablePrefix();

$sql = ‘SELECT `entity_id`
FROM `’ . $tablePrefix . ‘customer_entity`
WHERE email = ”’ . $mail . ‘“
AND store_id = “‘.Mage::app()->getStore()->getStoreId().’”
AND website_id = “‘.Mage::getModel(’core/store’)->load(Mage::app()->getStore()->getStoreId())->getWebsiteId().’”
LIMIT 1’;
$r = $db_read->fetchRow($sql);

if ($r) {

$session->loginById($r[’entity_id’]);
}

Please help me

Best regards

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top