Skip to content

Instantly share code, notes, and snippets.

@KATT
Created September 14, 2011 08:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KATT/1216073 to your computer and use it in GitHub Desktop.
Save KATT/1216073 to your computer and use it in GitHub Desktop.
Non-working loginAction()
<?php
// Include parent
require_once 'Mage/Adminhtml/controllers/CustomerController.php';
class MyNamespace_CustomerLogin_CustomerController extends Mage_Adminhtml_CustomerController {
function loginAction() {
$customerID = (int) $this->getRequest()->getParam('id');
$session = $this->_getSession();
$session->loginById($customerID);
$this->_redirectUrl(Mage::getBaseUrl());
}
/**
* Retrieve customer session model object
*
* @return Mage_Customer_Model_Session
*/
protected function _getSession() {
return Mage::getSingleton('customer/session');
}
}
@corleonis
Copy link

public function indexAction() {
$session = Mage::getSingleton('customer/session');
$locaUser = $this->getUserById($userId);
$session->setCustomer($locaUser);
Mage::dispatchEvent('customer_login', array('customer'=>$locaUser));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment