1
ralf57
"group_multi" formtype usage ?
  • 2005/2/8 8:26

  • ralf57

  • Quite a regular

  • Posts: 231

  • Since: 2003/2/3 1


Hi all,
i've set a config option using a "group_multi" formtype.
Now i need to use its values in a module by cheching if a user
belongs to the group(s) this option is set for (ex. writeprivilege)
Which is the correct statement for this?
Thanks in advance,ralf.

2
Mithrandir
Re: "group_multi" formtype usage ?

if (array_intersect($xoopsUser->getGroups(), $xoopsModuleConfig['writeprivilege'])) {
    
//user is in a group that is included in the module preference
}

3
ralf57
Re: "group_multi" formtype usage ?
  • 2005/2/8 8:41

  • ralf57

  • Quite a regular

  • Posts: 231

  • Since: 2003/2/3 1


Thank you Mith,
i'll try and let you know even if i guess it works perfectly.

4
ralf57
Re: "group_multi" formtype usage ?
  • 2005/2/8 9:56

  • ralf57

  • Quite a regular

  • Posts: 231

  • Since: 2003/2/3 1


It works fine but in some pages i get this error:
Fatal errorCall to a member function on a non-object

I think this is why i'm using the code you provided in pages that aren't in a module
Shall i put the some additional code before?
Ex:
$gperm_handler =& xoops_gethandler('groupperm');

Thanks again,ralf

5
Mithrandir
Re: "group_multi" formtype usage ?

if (!isset($GLOBALS['xoopsModule']) || $GLOBALS['xoopsModule']->getVar('dirname') != "moddir") {
                
$mod_handler =& xoops_gethandler('module');
                
$module =& $mod_handler->getByDirname('moddir');
                
$conf_handler =& xoops_gethandler('config');
                
$moduleConfig =& $conf_handler->getConfigsByCat(0$module->getVar('mid'));
            }
            else {
                
$moduleConfig =& $GLOBALS['xoopsModuleConfig'];
            }

replace moddir with your module's dirname

Login

Who's Online

211 user(s) are online (138 user(s) are browsing Support Forums)


Members: 0


Guests: 211


more...

Donat-O-Meter

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

Latest GitHub Commits