How to customise amember user tab menu

Discussion in 'aMember Pro v.4' started by bennyuk1, Jan 24, 2012.

Thread Status:
Not open for further replies.
  1. dale_s

    dale_s aMember Pro Customer

    Joined:
    Apr 12, 2013
    Messages:
    78
    Thank you for the reply. I tried this, but it didn't change button color on active state:

    Code:
    ul.am-tabs li.active > a {
        background: #88bc40 !important;
    }
    Any other ideas on what might work?
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,689
    I tested this CSS on my local setup and it seems to work.
    Did you clear browser/server cache after CSS file update?
  3. dale_s

    dale_s aMember Pro Customer

    Joined:
    Apr 12, 2013
    Messages:
    78
    I did clear browser/server cache. The css you provided does work if I temporarily remove the custom button code I posted here earlier (from site.php).

    But when the button code is present in site.php, it doesn't work. The custom button code seems to strip out the buttons from having an active state where the css can be used.
  4. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,689
    I am sorry. I missed this point. It is not related to CSS at all. This items just do not have class "active".
    I thought you want to change default color with some custom one.

    You need to use a bit different code so aMember can properly detect active state.

    Please use this code instead:
    PHP:
    Am_Di::getInstance()->hook->add(Am_Event::USER_MENU, function (Am_Event $event) {
            
    $event->getMenu()->addPage(array(
                    
    'id' => 'help',
                    
    'label' => 'Tickets',
                    
    'module' => 'helpdesk',
                    
    'controller' => 'index',
                    
    'action' => 'index',
                    
    'order' => 3
                
    ));
    });
  5. dale_s

    dale_s aMember Pro Customer

    Joined:
    Apr 12, 2013
    Messages:
    78
    Thank you very much. It does seem to work now. I do have some custom links in tabs which lead outside of aMember, such as:

    Code:
    $event->getMenu()->addPage(
                array(
                    'id' => 'dashboard',
                    'label' => 'Dashboard',
                    'uri' => '/my-custom-link/',
                    'order' => 1
                )
            );    
    Please let me know how to format this code with your adjustments above so it will work. I've tried and can't the custom link to work.
  6. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,689
    '/my-custom-link/' is url within aMember or outside of aMember?
  7. dale_s

    dale_s aMember Pro Customer

    Joined:
    Apr 12, 2013
    Messages:
    78
    Caesar - link I was asking about would be pointing outside of aMember.

    Rather than hijacking this thread, I asked for help through a ticket. Here is the working solution in case anyone ever needs this:

    Code:
    For your custom link please use:
    ================================
    $event->getMenu()
    ->addPage(array(
    'id' => 'dashboard2',
    'label' => 'Dashboard',
    'uri' => '/my-account/',
    'order' => 3
    ));
    
    For Profile form:
    =================
    $event->getMenu()
    ->addPage(array(
    'id' => 'edit',
    'label' => 'Edit Account',
    'module' => 'default',
    'controller' => 'profile',
    'route' => 'profile',
    'order' => 2
    ));
    caesar likes this.
Thread Status:
Not open for further replies.

Share This Page