How do you remove the newsletter link from the customer account navigation in Magento?
We have started using the Advanced Newsletter extension and now have two newsletter links in our customer account navigation, one for the the default newsletter and the other for the default newsletter.
I can see that the default newsletter link is added to customer account nav in app/design/frontend/base/default/layout/newsletter.xml on ln 48 with:
<customer_account>
<!-- Mage_Newsletter -->
<reference name="customer_account_navigation">
<action method="addLink" translate="label" module="newsletter"><name>newsletter</name><path>newsletter/manage/</path><label>Newsletter Subscriptions</label></action>
</reference>
<remove name="left.newsletter"/>
</customer_account>
I've tried removing this link in our theme's local.xml with:
<reference name="customer_account_navigation">
<!--<action method="removeLinkByName"><name>newsletter</name></action>-->
<!--<remove name="newsletter"/>-->
<action method="removeLinkByUrl"><url helper="newsletter/manage/"/></action>
</reference>
None of these methods have worked for me & I get an error when I try to remove them with an action method.
<action method="removeLinkByName"><name>newsletter</name></action>
gives this error: Invalid method Mage_Customer_Block_Account_Navigation::removeLinkByName(Array
<action method="removeLinkByUrl"><url helper="newsletter/manage/"/></action>
gives this error: Fatal error: Class 'Mage_Newsletter_Helper_Manage' not found in /app/Mage.php on line 546
While <remove name="newsletter"/>
gives no error but does not remove the link
Best Answer
You need to rewrite Magento's Customer Mage_Customer_Block_Account_Navigation Block class.
create config.xml file in the app/code/local/Neo/CustomerNavigationLinks/etc
in Neo/CustomerNavigationLinks/Block/Account/ careate a file called Navigation.php with the following content in it
in app/etc/modules create a file called Neo_CustomerNavigationLinks.xml with the following content
Now in local.xml add following content