User Tabs/Customizations

Discussion in 'aMember Pro v.4' started by darren, Oct 17, 2011.

  1. darren

    darren Member

    Joined:
    Aug 22, 2006
    Messages:
    36
    Does anyone know how to customize the end-user's tabs when they are logged in? If so, which specific file(s) is it & where is it located?

    Wish we had a manual for V4...
  2. interactivbiz

    interactivbiz New Member

    Joined:
    Jul 3, 2011
    Messages:
    9
    Tabs/Customizations

    The way I did it:

    1. Create a new module in the application folder.
    2. Create the files Bootstrap.php and module.xml (or copy and edit them from another module)
    3. Enable the module in Admin/Config.
    4. Then you can do something like this, in Bootstrap.
      PHP:
      class Bootstrap_MyModule extends Am_Module {

          function 
      onUserMenu(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);

          }

      onUserMenu is all fairly Zend framework stuff.

      I also define new Blocks for the members 'dashboard' in the module, and also some customised views/templates.

      The helpdesk module is a good place to look.
  3. darren

    darren Member

    Joined:
    Aug 22, 2006
    Messages:
    36
    Thank you!
  4. darren

    darren Member

    Joined:
    Aug 22, 2006
    Messages:
    36
    As a follow-up, Alex suggested this code and it works for adding tabs

    Code:
              $this->addPage(array(
                    'id' => 'users',
                    'uri' => 'http://mysite.com/xx',
                    'label' => 'My Label'));
    
  5. wallpaper_01

    wallpaper_01 Member

    Joined:
    Mar 9, 2011
    Messages:
    116
    Hi, I tried this and it does what it says, but It keeps just replacing the tab 'add/renew subscription' I have changed the order to 6 or another number, just want it to appear on the end after helpdesk or add in to another area. Also for 'id' what do I put in here?

    Thanks,

    Dan
  6. wallpaper_01

    wallpaper_01 Member

    Joined:
    Mar 9, 2011
    Messages:
    116
    I actually got it it to add a tab now by deleting the last part, but I still cant put it in the order I want.
  7. darren

    darren Member

    Joined:
    Aug 22, 2006
    Messages:
    36
    Add this at the bottom of your tab. The 300 is the order of the tabs appearance.

    PHP:
                'order' => 300,
  8. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    Another way to do the same from application/configs/site.php

    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);
  9. dikovsky

    dikovsky New Member

    Joined:
    Nov 1, 2011
    Messages:
    11
    Hi Alex, I've done as you suggested, but nothing changes.
    In the directory application/configs/ I renamed site-dist.php to site.php and put mentioned code there. No new tabs appeared in the users inteface. Did I missed something?
  10. dikovsky

    dikovsky New Member

    Joined:
    Nov 1, 2011
    Messages:
    11
    Well, I found my mistake (was still editing site-dist.php) Everything works!

Share This Page