Adding custom search links to dashboard

Discussion in 'Customization & add-ons' started by bennyuk1, Jul 31, 2017.

  1. bennyuk1

    bennyuk1 aMember Pro Customer

    Joined:
    Jan 12, 2012
    Messages:
    200
    Is there a way I can add links to the admin dashboard linking to custom "saved searches", even if its just hard coded links, eg
    /amember/admin-users?_u_search_load=39&my_submit=Submit
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Hello,

    Yes, it is possible to do. You can add it with the following code in site.php file:
    http://www.amember.com/docs/Site.php_file

    PHP:
    Am_Di::getInstance()->hook->add(Am_Event::ADMIN_MENU, function(Am_Event $e) {
       
    $e->getMenu()
           ->
    addPage(array(
               
    'label' => 'Saved Search',
               
    'uri' => '/amember/admin-users?_u_search_load=39&my_submit=Submit',
               
    'order' => 1
           
    ));
    });
    Best Regards.
    masdika likes this.
  3. bennyuk1

    bennyuk1 aMember Pro Customer

    Joined:
    Jan 12, 2012
    Messages:
    200
    Great, is it possible to add a number of items to the menu? I can get it to work with 1, as above, but need to add 3 items to the menu
  4. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Yes, you can add any number:
    PHP:
    Am_Di::getInstance()->hook->add(Am_Event::ADMIN_MENU, function(Am_Event $e) {
      
    $m $e->getMenu()
      
    $m->addPage(array(
               
    'label' => 'Saved Search',
               
    'uri' => '/amember/admin-users?_u_search_load=39&my_submit=Submit',
               
    'order' => 1
           
    ));
      
    $m->addPage(array(
               
    'label' => 'Another Saved Search',
               
    'uri' => '/amember/admin-users?_u_search_load=39&my_submit=Submit',
               
    'order' => 2
           
    ));
       
    //etc
    });

Share This Page