How to add simple account / logout links where login changes to logout when signed in ( login / register ) for cms magento 1.x ?
Just insert this code into your phtml:
<div class="account-links">
<?php
if ($this->helper('customer')->isLoggedIn()) {
?>
<a href="<?php echo Mage::getUrl('customer/account'); ?>">Account</a>
<a href="<?php echo Mage::getUrl('customer/account/logout'); ?>"><?php echo $this->__('Log out'); ?></a>
<?php } else {
?>
<a href="<?php echo Mage::getUrl('customer/account/login'); ?>"><?php echo $this->__('Log in'); ?></a>
<span> or</span>
<a href="<?php echo Mage::getUrl('customer/account/create'); ?>"><?php echo $this->__('Register'); ?></a>
<?php } ?>
</div>
OR
<?php
if ($this->helper('customer')->isLoggedIn()) {
?>
<span class="widget widget-cms-link-inline"><a href="<?php echo Mage::getUrl('customer/account'); ?>">Account</a></span>
<span class="widget widget-cms-link-inline"><a href="<?php echo Mage::getUrl('customer/account/logout'); ?>"><?php echo $this->__('Log out'); ?></a></span>
<?php } else {
?>
<span class="widget widget-cms-link-inline"><a href="<?php echo Mage::getUrl('customer/account/create'); ?>"><?php echo $this->__('Register'); ?></a></span>
<span class="widget widget-cms-link-inline"><a href="<?php echo Mage::getUrl('customer/account/login'); ?>"><?php echo $this->__('Log in'); ?></a></span>
<?php } ?>
ALSO YOU CAN USE
<?php
if( ! Mage::getSingleton('customer/session')->isLoggedIn()){
//not logged in
}else{
// logged in
}
?>