1
phatjew
speaking of permissions for modules . . .
  • 2003/10/18 17:34

  • phatjew

  • Just popping in

  • Posts: 56

  • Since: 2003/10/8


The module I am writing has sub-menu items in the main menu. One of them is a "submit" link, exactly lke the one for the Web Links module. However, I only want the submit menu option to show up for certain groups. Is there a way to change a module's Main Menu options based on group permissions?

Thanks in advance for any help with this.

--Rafi

Speak to me in PHP.

2
mrgym
Re: speaking of permissions for modules . . .
  • 2003/10/18 21:30

  • mrgym

  • Just popping in

  • Posts: 28

  • Since: 2002/4/26


There are a couple of ways.

1. hiding submenu items can be done in the template for ALL submenu items. Add a smarty <{if}> to the system_block_mainmenu.html using the template manager.

<{foreach item=sublink from=$module.sublinks}>
<{if $xoops_isuser == true}>
<{$sublink.name}>
<{/if}>
<{/foreach}>

2. Your submenu can be generated dynamically. xoops_version.php can look like this;

//submenu
if($xoopsUser){
//make a submenu if is a user
include_once("include/db.class.php");

//global $xoopsDB or
//$GLOBALS['xoopsDB'] even for globals off

$menuDB = new db($GLOBALS['xoopsDB'],$_GET);

//then feed the array to the modversion[sub] array
foreach($menuDB->menu as $k=>$v){
$modversion['sub'][$k]['name']=$v['name'];
$modversion['sub'][$k]['url']= $v['url'];
}

}

//there are already enough vars!
unset($menuDB);

If you need to be more precise than "is this a user" then see the top post in this modules forum.


3
phatjew
Re: speaking of permissions for modules . . .
  • 2003/10/22 23:09

  • phatjew

  • Just popping in

  • Posts: 56

  • Since: 2003/10/8


Thanks -- that was a great answer. I should have thought of it myself, but I am a XOOPS newbie.


Login

Who's Online

275 user(s) are online (164 user(s) are browsing Support Forums)


Members: 0


Guests: 275


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits