How to add/remove link in "Useful Links" block

From aMember Pro Documentation
Revision as of 02:43, 19 May 2016 by Alexander (talk | contribs) (Created page with "In order to create own link, add this code to site.php file: <source> <?php Am_Di::getInstance()->hook->add(Am_Event::GET_MEMBER_LINKS, function (Am_Event $event){ $...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In order to create own link, add this code to site.php file:


<?php 
Am_Di::getInstance()->hook->add(Am_Event::GET_MEMBER_LINKS, function (Am_Event $event){
    $event->addReturn('LINK TITLE', '/url/');
});


In order to remove link use this code(example is to remove "Payment History" link):


<?php
Am_Di::getInstance()->hook->add(Am_Event::GET_MEMBER_LINKS, function(Am_Event $e){
    $ret = $e->getReturn();
    foreach($ret as $k=>$v)
        if(strpos($k, 'payment-history')!==false)
            unset($ret[$k]);
    $e->setReturn($ret);
});