I am checking in my custom controller if customer is logged in or not if the customer clicks on register after registration it should redirect to my custom controller and continue the process. I am using customer_register_success it is executing but i am getting blank customer session in my custom function.Suggest me some solution. This my custom function
public function getcustomerdata()
{
if(Mage::getSingleton('customer/session')->isLoggedIn())
{
$customerData = Mage::getSingleton('customer/session')->getCustomer();
echo $customerData->getId();
$name = $customerData->getFirstname();
}
return $name;
}
My observer function is.
public function doSomething($observer)
{
$AccountController = $observer->getEvent()->getAccountController();
$Customer = $observer->getEvent()->getCustomer();
$session=Mage::getSingleton('customer/session');
$session->setBeforeAuthUrl(Mage::getSingleton("mymodule/session")->getCompurl().'state_new/1');
if (!$Customer->getCustomerActivated()) {
}
else{
//$session->setCustomerAsLoggedIn($Customer);
$response1 = Mage::app()->getResponse(); // observers have event args
$dataarray = Mage::getSingleton("mymodule/session")->getData_array();
$sampleid=$dataarray['sampleid'];
$state=$dataarray['state'];
if($state==1)
{
$collection=Mage::getSingleton('mymodule/mymodule')->customisesaved($sampleid);
if($collection)
{
$url=Mage::getUrl('mymodule/mymodule/customshow');
Mage::log($url,null,"url.log");
Mage::app()->getFrontController()->getResponse()->setRedirect($url);
Mage::app()->getResponse()->sendResponse();
exit;
}
}
}
}