1
dreamgear
request: pass list of groups to template
  • 2006/2/18 16:04

  • dreamgear

  • Friend of XOOPS

  • Posts: 78

  • Since: 2002/7/18


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.

2
koertzen
Re: request: pass list of groups to template
  • 2006/3/21 20:59

  • koertzen

  • Just popping in

  • Posts: 79

  • Since: 2003/10/22


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
[size=x-small]Be the change you wish to see in the world.
-Ghandi[/size]

Login

Who's Online

184 user(s) are online (117 user(s) are browsing Support Forums)


Members: 0


Guests: 184


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