if(!Mage::getSingleton("customer/session")->isLoggedIn()){
$session = Mage::getSingleton("customer/session");// Store The Current Page Url Where User will be redirected once loggedin
$session->setBeforeAuthUrl(Mage::helper("core/url")->getCurrentUrl());
$customerLoginURL = Mage::getBaseUrl() . "customer/account/login";
Mage::app()->getFrontController()->getResponse()->setRedirect($customerLoginURL)->sendResponse();
}