Difference between revisions of "How to customize user tabs in member's area"

From aMember Pro Documentation
Jump to: navigation, search
(Created page with "Let's say you ant to add one tab to member's area and remove Add Renew tab. Add this code to /amember/application/configs/site.php: <source> <?php Am_Di::getInstance()->hook...")
 
m (Spelling, wording, grammar.)
Line 1: Line 1:
Let's say you ant to add one tab to member's area and remove Add Renew tab.  
+
Let's say you want to add a tab to the member's area and remove the Add/Renew tab.  
  
  

Revision as of 12:56, 19 September 2012

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);
}