How to customize user tabs in member's area

From aMember Pro Documentation
Revision as of 12:56, 19 September 2012 by Unsable (Talk | contribs)

Jump to: navigation, search

Let's say you want to add a tab to the member's area and remove the Add/Renew tab.


Add this code to /amember/application/configs/site.php:

<?php
Am_Di::getInstance()->hook->add('userMenu', 'siteUserMenu');
function siteUserMenu(Am_Event $event)
{
      // $user = $event->getUser(); // if required
      $menu = $event->getMenu();
      // eg; add a tab
      $menu->addPage(array(
              'id' => 'mypage',
              'label' => ___('Do The Thing'),
              'uri' => '/the.thing',
              'order' => 2,
       ));
       // remove a page
       $page = $menu->findOneBy('id', 'add-renew');
       $menu->removePage($page);
}