$topMenuLinks & privileges in plugin on non super-admin mode

Advanced Questions & Problems

$topMenuLinks & privileges in plugin on non super-admin mode

Postby Zéfling » 1:09pm, Tue 10 Jun, 2014

Hi,

I write a module, but a I a little problem with $topMenuLinks. If the user is not a super admin, I do not found an answer for link do not disappear in the top menu.

My solution, change the core code on admin/connect.php in the begin of the function topMenu() :

Code: Select all
if (sizeof($GLOBALS["plugins"])) {
  foreach ($GLOBALS["plugins"] as $pluginName => $plugin) {
    $menulinks = $plugin->topMenuLinks;
    foreach ($menulinks as $link => $linkDetails) {

      $access = $_SESSION["logindetails"]['superuser'] ||
          !empty($_SESSION['privileges'][$linkDetails['access']]);
                      
      if (isset($GLOBALS['pagecategories'][$linkDetails['category']])
            && $access) {
        array_push($GLOBALS['pagecategories'][$linkDetails['category']]['menulinks'],$link.'&pi='.$pluginName);
      }
    }
  }
}


In the plug-in, I add “access” on array $topMenuLinks :

Code: Select all
public $topMenuLinks =  array(
   'Config' => array('category' => 'config',     'access' => 'settings'),
   'Send'   => array('category' => 'campaigns',  'access' => 'campaigns'),
   'Stats'  => array('category' => 'statistics', 'access' => 'statistics'),
);


Sorry for my english.
Zéfling
phpList newbie
 
Posts: 1
Joined: 10:05am, Tue 10 Jun, 2014

Return to Advanced Questions & Problems

Who is online

Users browsing this forum: No registered users and 1 guest