xoops forums

dreamgear

Friend of XOOPS
Posted on: 2006/2/18 16:04
dreamgear
dreamgear (Show more)
Friend of XOOPS
Posts: 78
Since: 2002/7/18
#1

request: pass list of groups to template

I made the following hack to header.php to allow me to show different things based on whether users are members of a specific group:
*** header.php.orig_060218      Sat Feb 18 15:40:09 2006
--- header.php  Sat Feb 18 15:57:11 2006
***************
*** 
85,104 ****
--- 
85,105 ----
          
$xoopsTpl->assign('xoops_banner'' ');
      }
      
// Weird, but need extra <script> tags for 2.0.x themes
      
$xoopsTpl->assign('xoops_js''//--></script><script type="text/javascript" src="'.XOOPS_URL.'/include/xoops.js"></script><script type="text/javascript"><!--');
      
// get all blocks and assign to smarty
      
$xoopsblock = new XoopsBlock();
      
$block_arr = array();
      if (
$xoopsUser != '') {
          
$xoopsTpl->assign(array('xoops_isuser' => true'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUserIsAdmin));
          
$groups $xoopsUser->getGroups();
+         
$xoopsTpl->assign('xoops_ugroups',$groups);
      } else {
          
$xoopsTpl->assign(array('xoops_isuser' => false'xoops_isadmin' => false));
          
$groups XOOPS_GROUP_ANONYMOUS;
      }
      
$toppage false;
      if (isset(
$xoopsModule) && is_object($xoopsModule)) {
          
// set page title
          
$xoopsTpl->assign('xoops_pagetitle'$xoopsModule->getVar('name'));
          
$xoopsTpl->assign('xoops_dirname'$xoopsModule->getVar('dirname'));
          
$moduleid $xoopsModule->getVar('mid');
The line that begins with the plus sign "+" is the only addition. It would be nice if this made it into the next version. BTW this site is running 2.0.13.1.

koertzen

Just popping in
Posted on: 2006/3/21 20:59
koertzen
koertzen (Show more)
Just popping in
Posts: 79
Since: 2003/10/22
#2

Re: request: pass list of groups to template

I agree. I made a similar hack to set a flag if a user is a member of a particular group that was central to that particular installation, which I shall refer to as "install": install_isvolunteer, install_isstaff.

It will make my job easier if the core references these groups and passes them to the template so that I can create end-user interfaces referencing these groups without such a hack.

Thanks,
Jeff
Be the change you wish to see in the world.
-Ghandi