1
krystinevo
smarty variable for groups in a welcome block

I'd like to create a welcome block for registered users which states, "Welcome (users name). You are a member of the following groups: (group1, group2, etc)."

I'm sure there's a way to do this (newbb lists a user's groups) but I sure can't figure it out, or find it in a search.

Thanks in advance,

Kristine

2
Mithrandir
Re: smarty variable for groups in a welcome block

In module or block code:
global $xoopsUser;
if (
$xoopsUser) {
    
$groups $xoopsUser->getGroups();
    
$group_handler =& xoops_gethandler('group');
    
$GLOBALS['xoopsTpl']->assign('usergroups'$group_handler->getList('groupid'"(".implode(','$groups).")""IN"));
}


In smarty template:
Welcome <{$xoops_uname}>. You are a member of the following groups: (
<{foreach 
item=group from=$usergroups name=ugroups}>
    <{
$group}>
    <{if !
$smarty.foreach.ugroups.last}>,<{/if}>
<{/foreach}>

3
krystinevo
Re: smarty variable for groups in a welcome block

Thanks very much Mith!

4
krystinevo
Re: smarty variable for groups in a welcome block

Okay. I'm not as smart as I thought I was...

When you say I should insert that second block of code, In smarty template, where exactly does it go? Smarty.class.php?

Thanks again for your help.

5
krystinevo
Re: smarty variable for groups in a welcome block

*polite bump*

Can anyone give me a hint?

6
GmanGeo
Re: smarty variable for groups in a welcome block
  • 2005/6/12 14:36

  • GmanGeo

  • Just popping in

  • Posts: 1

  • Since: 2005/4/25


I too, would like to enable this feature on my site, but Mith's suggestion is a bit too general for my level of experience. If someone, (or Mithrandir) would like to provide more specific instructions on where/how to implant the code bites (file name(s)?), I'd appreciate it. Thanks much.

7
Anonymous
Re: smarty variable for groups in a welcome block
  • 2005/6/12 14:59

  • Anonymous

  • Posts: 0

  • Since:


Hi,

Second code for theme.html

8
krystinevo
Re: smarty variable for groups in a welcome block

Thanks for clarifying Mowaffak! I'll give this a try...

9
Probez
Re: smarty variable for groups in a welcome block
  • 2005/10/17 7:35

  • Probez

  • Just popping in

  • Posts: 11

  • Since: 2005/8/15


I have tried the block script and I get get a blank page, i haven't enabled debug, my XOOPS is 2.2.2

Thanks for Mith's work for us and Xoops

10
Shine
Re: smarty variable for groups in a welcome block
  • 2005/10/17 8:01

  • Shine

  • Just can't stay away

  • Posts: 822

  • Since: 2002/7/22


Since we are busy........ What is the needed code to show one uid nr?

Grtz., Shine

Login

Who's Online

142 user(s) are online (109 user(s) are browsing Support Forums)


Members: 0


Guests: 142


more...

Donat-O-Meter

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

Latest GitHub Commits