Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Is it possible to only display “My Account” link in Top Links when the user is logged-in? 
 
TChamber
Jr. Member
 
Total Posts:  21
Joined:  2008-09-05
 

Hi…
Is it possible to only display the “My Account” link that appears in the Top Links (alongside “My Wishlist”, “My Cart”, etc.) when the user is logged-in?  In other words, when the user is not logged-in, “My Account” will not be displayed.
If it’s possible, how can that be done?  I’ve not found a way to do this.

Thanks in advance.

 
Magento Community Magento Community
Magento Community
Magento Community
 
fivestar
Sr. Member
 
Total Posts:  115
Joined:  2008-06-18
 

I don’t know how doing so would be helpful to your users, but I’m thinking a simple PHP if statement in the appropriate template file. First you need to locate the header file that generates top_links (do a search for My Account in your template folder). There must already be an if-statement in that file that changes “log-in” to “log-out"- add another PHP-if to show/hide My accounts link when user is logged in/off.

Something like such:

<?php if (user is not logged in- use magento's if-call for reference) ?> <span style="display:none;">My_accounts link goes here</span> <?php endif; ?>

Check php-if syntax to be sure the above is correct

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top