How To Add A Button In User's Dashboard

Discussion in 'Customization & add-ons' started by stevenjones, Oct 22, 2012.

  1. stevenjones

    stevenjones Member

    Joined:
    Apr 18, 2012
    Messages:
    42
    Hello!

    I've been working on this for the last 2 - 3 days and I cannot get it to work. I've been following the advice on the forum.

    I want to add a button in the user's members area. This button should redirect to the forum we have set on the server (www.domainname.com/forum). I've tried the stuff in the following thread: http://www.amember.com/forum/threads/how-to-customise-amember-user-tab-menu.14129/

    Though everything gives me an error...

    Parse error: syntax error, unexpected '<' in /home/private/public_html/membersarea/application/configs/site.php on line 7

    Parse error: syntax error, unexpected '<' in /home/private/public_html/membersarea/application/configs/site.php on line 15

    Obviously I am doing something wrong... I use the file located in the amember/applications/configs/site-dist.php and renamed it to site.php to override default functions.. After renaming it gives the error.

    So to summarize, adding a redirect button to a forum is I need to do..

    Help would be appreciated!

    Steven
  2. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    please copy/paste your entire site.php
  3. stevenjones

    stevenjones Member

    Joined:
    Apr 18, 2012
    Messages:
    42
    Code:
    <?php
     
    if (!defined('INCLUDED_AMEMBER_CONFIG'))
        die("Direct access to this location is not allowed");
     
     
    <?php
    Am_Di::getInstance()->hook->add(Am_Event::USER_MENU, 'onUserMenu');
      function onUserMenu(Am_Event $event)
        {
            $event->getMenu()->addPage(
                array(
                    'id' => 'pageid',
                    'label' => 'Forum',
                    'uri' => '/forum',
                    'order' => 1000
                )
            );
        }
    ?>
  4. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    There is unnecessary <?php
    try this
    PHP:
    <?php
     
    Am_Di
    ::getInstance()->hook->add(Am_Event::USER_MENU'onUserMenu');
    function 
    onUserMenu(Am_Event $event)
        {
            
    $event->getMenu()->addPage(
                array(
                    
    'id' => 'pageid',
                    
    'label' => 'Forum',
                    
    'uri' => '/forum',
                    
    'order' => 1000
                
    )
            );
        }
    stevenjones likes this.
  5. stevenjones

    stevenjones Member

    Joined:
    Apr 18, 2012
    Messages:
    42
    Worked like a charm :) Thanks Alex.

    Immediately installed on both my licenses and another copy I manage for a partner.

Share This Page