1
canadaka
check if user is in certain group in themes
  • 2006/5/29 20:47

  • canadaka

  • Just popping in

  • Posts: 8

  • Since: 2005/8/4 0


i have some code in the theme .html template file that I only load for users with this:

<{if !$xoops_isuser}>

But i want to change it to only load if the user is in a certain group. How could I do this?

2
christian
Re: check if user is in certain group in themes
  • 2006/5/29 22:12

  • christian

  • Just can't stay away

  • Posts: 401

  • Since: 2002/2/24


You can attempt this in your mainfile.php, the author is Blueteen.

le="color: #000000"><?php // display a different theme $groupes = 0; if (is_object($xoopsUser)) { $groupes = $xoopsUser->getGroups(); } else { $groupes = array(XOOPS_GROUP_ANONYMOUS); } switch($groupes) { case (in_array(1, $groupes)): //admin $xoopsConfig['theme_set'] = 'phpkaox'; break 1; case (in_array(2, $groupes)): //enregistrés $xoopsConfig['theme_set'] = 'twisted'; break 1; case (in_array(3, $groupes)): //anonyme default: $xoopsConfig['theme_set'] = 'default'; break 1; case (in_array(4, $groupes)): //autre $xoopsConfig['theme_set'] = 'default'; break 1; } //end

3
canadaka
Re: check if user is in certain group in themes
  • 2006/5/29 22:31

  • canadaka

  • Just popping in

  • Posts: 8

  • Since: 2005/8/4 0


hmm I can't really use that method. I already ahve 5 different themes, different colours that load depending on what module you are in.

So i don't want 5 * 2 themes, way to many to manage if there is updates.