How to get the login & logout url in magento?

Following is the code to get the login & logout link.

//check the user is loggedon or not
if (! Mage::getSingleton('customer/session')->isLoggedIn()){
//if user logged on show the logout link - add this code within anchor tag
echo Mage::helper('customer')->getLoginUrl();
}
else{
//if user is not logged on yet show the login link - add this code within anchor tag
echo Mage::helper('customer')->getLogoutUrl();
}

Here are more variable’s that may you need to get the customer data on the frontend.

bool customerHasAddresses ()
string getAccountUrl ()
Mage_Customer_Model_Customer getCurrentCustomer ()
Mage_Customer_Model_Customer getCustomer ()
string getCustomerName ()
string getDashboardUrl ()
string getEditPostUrl ()
string getEditUrl ()
string getEmailConfirmationUrl ([string $email = null])
string getForgotPasswordUrl ()
Mage_Customer_Model_Entity_Group_Collection getGroups ()
string getLoginPostUrl ()
string getLoginUrl ()
string getLogoutUrl ()
string getRegisterPostUrl ()
string getRegisterUrl ()
bool isConfirmationRequired ()
bool isLoggedIn ()
bool isRegistrationAllowed ()
Source : www.adeelishfaq.com/blog/how-to-get-the-login-logout-url-in-magento/
%d bloggers like this: