In the custom theming some times we need to display the custom Myaccount, Login and logout link on the header,
the solution is given below:
<?php $loggedIn = $this->helper("customer")->isLoggedIn(); if($loggedIn == 1){ echo "<a href=\"".Mage::getBaseUrl()."customer/account/\" />My Account</a>"; } //If the user is logged in, then show a button to logout. else{ echo "<a href=\"".Mage::getBaseUrl()."customer/account/create/\" />Register</a>"; } //If the user is not logged in, then show a button to login ?> <?php $loggedIn = $this->helper("customer")->isLoggedIn(); if($loggedIn == 1){ echo "<a href=\"".Mage::getBaseUrl()."customer/account/logout/\" />LOGOUT</a>"; } //If the user is logged in, then show a button to logout. else{ echo "<a href=\"".Mage::getBaseUrl()."customer/account/\" />LOGIN</a>"; } //If the user is not logged in, then show a button to login ?>
Hope it helps and thanks for reading.