Magento – Top Links Only Show When Customer is Logged In

layout

I've eliminated all of my top links with the exception of:

Login

My Cart

I've done this by commenting out the appropriate sections in my themes customer.xml file.

Now what I would like to do is have the following display when the customer logs in:

My Account

Compare

Wish list

I have tried to place the layout information as follows for My Account however I haven't be able to get it to work:

  <customer_logged_in>
    <reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>10</position></action>
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
    </reference>
</customer_logged_in>

How can I display the customer specific links only when they are logged in?

Best Answer

My final xml modifications are the following:

    <customer_logged_in>
    <reference name="top.links">
        <action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>10</position></action>
        <action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
        <action method="addLink" translate="label title">
        <label>Compare</label>
        <url>catalog/product_compare/index/</url>
        <title>Compare</title>
        <prepare>false</prepare>
        <position>20</position>
        <target>_blank</target>
</action>
    </reference>
</customer_logged_in>

This will show only Log Out, My Account and Compare in the top links menu for customers that are logged in. When logged out only Login.

Note: I have the wishlist disabled in the admin panel.