1
corne
Hide submenu
  • 2005/1/21 11:22

  • corne

  • Just popping in

  • Posts: 24

  • Since: 2005/1/12


It's possible to create a submenu for a module in the xoops_version.php but is it also possible to only show the submenu to users of a specific group??

When a guest enters the site he can see the menu, but the submenu is hidden
When a user of a specific group enters the site the submenu can be seen....

Is this possible?

2
Chainsaw
Re: Hide submenu
  • 2005/1/21 11:40

  • Chainsaw

  • Quite a regular

  • Posts: 304

  • Since: 2003/9/28


Search and install the Multimenu module. It has menu/submenu with group permissions.

3
Dave_L
Re: Hide submenu
  • 2005/1/21 11:44

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Yes, it's possible. Here's an example (from my chess module).

'groups_play' is a module configuration parameter that contains a list of user groups.

xoops_version.php

...

// Config

$modversion['config'][1]['name']        = 'groups_play';
$modversion['config'][1]['title']       = '_MI_CHESS_GROUPS_PLAY';
$modversion['config'][1]['description'] = '_MI_CHESS_GROUPS_PLAY_DES';
$modversion['config'][1]['formtype']    = 'group_multi';
$modversion['config'][1]['valuetype']   = 'array';
$modversion['config'][1]['default']     = array(XOOPS_GROUP_ADMINXOOPS_GROUP_USERS);

...

// Menu

$modversion['hasMain'] = 1;

$modversion['sub'][1]['name'] = _MI_CHESS_SMNAME1;
$modversion['sub'][1]['url']  = 'help.php';

$modversion['sub'][2]['name'] = _MI_CHESS_SMNAME2;
$modversion['sub'][2]['url']  = 'index.php';

// Display create-game menu item if current user has the play-chess right.
global $xoopsModule$xoopsModuleConfig$xoopsUser;
if (
is_object($xoopsModule) and $xoopsModule->getVar('dirname') == 'chess'
   
and !empty($xoopsModuleConfig['groups_play']) and is_array($xoopsModuleConfig['groups_play'])
   and (
in_array(XOOPS_GROUP_ANONYMOUS$xoopsModuleConfig['groups_play'])
      or 
is_object($xoopsUser) and count(array_intersect($xoopsUser->getGroups(), $xoopsModuleConfig['groups_play'])) > 0))
{
   
$modversion['sub'][3]['name'] = _MI_CHESS_SMNAME3;
   
$modversion['sub'][3]['url']  = 'create.php';
}

...

Login

Who's Online

238 user(s) are online (115 user(s) are browsing Support Forums)


Members: 0


Guests: 238


more...

Donat-O-Meter

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

Latest GitHub Commits