1
Brad
"Site Info" Block; can show custom group?
  • 2004/2/11 0:06

  • Brad

  • Not too shy to talk

  • Posts: 150

  • Since: 2003/12/4


Is there an intuitive way that I'm overlooking to have the "Site Info" block show the members of a custom group? It appears to me that the block is configured to just show the default Admin group or no groups at all (there's a choice).

I realize that I can edit the code itself to grab my custom group but if there's a "standard" way of doing this, I'd much appreciate knowing it. I'd rather not change any of the original XOOPS files.

2
topet05
Re: "Site Info" Block; can show custom group?
  • 2004/2/11 2:54

  • topet05

  • Just popping in

  • Posts: 33

  • Since: 2003/4/19


Make a new block and set the "Content Type" for "PHP Script" and put this function in your block:
Quote:

function ExibeGrupos ($grupoNome,$numero)
{
global $xoopsUser;
$conecta =& Database::getInstance();
$myts =& MyTextSanitizer::getInstance();
$result = $conecta->query("SELECT u.uid, u.uname, u.email, u.user_viewemail, u.user_avatar, g.name AS groupname FROM ".$conecta->prefix("groups_users_link")." l LEFT JOIN ".$conecta->prefix("users")." u ON l.uid=u.uid LEFT JOIN ".$conecta->prefix("groups")." g ON l.groupid=g.groupid WHERE g.name='".$grupoNome."' ORDER BY RAND() limit ".$numero."");
if ($conecta->getRowsNum($result) > 0) {
echo '<table class="outer" cellspacing="0">';
$o_grupo = 0;
while ($usuarios = $conecta->fetchArray($result)) {
if ($o_grupo == 0){
echo'<tr><th colspan="2">'.$myts->htmlSpecialChars($usuarios['groupname']).'</th></tr>';
$o_grupo = 1;
}
if ($xoopsUser != '') {
echo'<tr><td class="even" valign="middle" align="center"><img src="'.XOOPS_URL.'/uploads/'.$usuarios['user_avatar'].'" alt="" width="32" /><br /><a href="'.XOOPS_URL.'/userinfo.php?uid='.$usuarios['uid'].'">'.$myts->htmlspecialchars($usuarios['uname']).'</a></td><td class="odd" width="20%" align="right" valign="middle"><a href="javascript:openWithSelfMain(\''.XOOPS_URL.'/pmlite.php?send2=1&to_userid='.$usuarios['uid'].'\',\'pmlite\',450,370);"><img src="'.XOOPS_URL.'/images/icons/pm_small.gif" border="0" width="27" height="17" alt="" /></a></td></tr>';
}else{
if ($usuarios['user_viewemail']) {
echo'<tr><td class="even" valign="middle" align="center"><img src="'.XOOPS_URL.'/uploads/'.$usuarios['user_avatar'].'" alt="" width="32" /><br /><a href="'.XOOPS_URL.'/userinfo.php?uid='.$usuarios['uid'].'">'.$myts->htmlspecialchars($usuarios['uname']).'</a></td><td class="odd" width="20%" align="right" valign="middle"><a href="mailto:'.$usuarios['email'].'"><img src="'.XOOPS_URL.'/images/icons/em_small.gif" border="0" width="16" height="14" alt="" /></a></td></tr>';
}else{
echo'<tr><td class="even" valign="middle" align="center"><img src="'.XOOPS_URL.'/uploads/'.$usuarios['user_avatar'].'" alt="" width="32" /><br /><a href="'.XOOPS_URL.'/userinfo.php?uid='.$usuarios['uid'].'">'.$myts->htmlspecialchars($usuarios['uname']).'</a></td><td class="odd" width="20%" align="right" valign="middle">&nbsp;</td></tr>';
}
}
}
echo'</table>';

}else{
echo 'O grupo selecionado não existe ou não contém nenhum membro.';
}
}


After put the function in your block, call:
echo ExibeGrupos("Group Name","Number of users in the block")
Sample:
echo ExibeGrupos("Webmasters","10");
This will show in the block 10 users of the Webmasters group (Order By RAND()).
Powered By XOOPS Brasil - The different community - Brazil
Visit:http://www.xoops.net.br (In the first steps, but walking!)

3
Brad
Re: "Site Info" Block; can show custom group?
  • 2004/2/11 4:02

  • Brad

  • Not too shy to talk

  • Posts: 150

  • Since: 2003/12/4


Thanks! This works just as I had hoped the "Site Info" block would. Matter of fact, this code looks quite similar. Thanks again.

Login

Who's Online

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


Members: 0


Guests: 163


more...

Donat-O-Meter

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

Latest GitHub Commits