I'm using Magento 1.9 version.
I want to redirect the customer to the login page only when they click on the review button in the product view page and also redirect to the same product view page after login. But it redirects when I load product view page.
I have used this code:
if(Mage::getSingleton('customer/session')->isLoggedIn()){
//some stuff
}else{
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('customer/account'))
}