如果客户登录wordpress,他会自动登录到magento
问题描述:
如果客户登录wordpress,他会自动登录到magento也 虽然客户的电子邮件ID和密码是注册时在magento以及单词按和在注册的情况下正常工作,但是当我想登录它不在magento中工作时。如果客户登录wordpress,他会自动登录到magento
这里附有影像
我已经尝试 这个代码 require_once( “店/应用/ Mage.php”); umask(0);
Mage::app("default");
$session = Mage::getSingleton("customer/session");
// Check if user is logged in
if($session->isLoggedIn())
{
// Yes user is logged in
echo "Yes user is logged in";
}else{
$session = Mage::getSingleton('customer/session', array('name' => 'frontend'));
$session->login("$email", "$password");
$session->setCustomerAsLoggedIn($session->getCustomer());
}
答
在登录wordpress后,您可以强制使用邮件地址的用户记录状态。
Mage::getSingleton('core/session', array('name' => 'frontend'));
$_customerExist = Mage::getModel('customer/customer')
->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('email', $_mail)
->getFirstItem();
$_customer = Mage::getModel('customer/customer')
->load($_customerExist->getentity_id());
if(!Mage::getSingleton('customer/session')->isLoggedIn()) {
$session = Mage::getSingleton('customer/session', array('name' => 'frontend'));
$session->setCustomer($_customer);
$session->setCustomerAsLoggedIn($_customer);
}
如果你想用密码来登录你可以在这里找到一个解决方案:
与您的版本去错了请告诉我?看看你的日志为什么登录失败。
+0
谢谢丹尼尔这不是我的问题,我想单次登录和访问WordPress和magento –
你有什么错误吗?或者用户是否没有登录magento? – Slatyoo
我没有收到任何错误。 –
所以..当你在wordpress注册用户登录或注册?请提供更多信息。你使用任何插件? – Slatyoo