Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 11:16 am EST

Geeklog Forums

Listing members?


ohNoes!

Anonymous
Is there a way to visually list (in a block) all the members of a certain permission group, the same way the "Who's Online" block does?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
There's such an option in the Admin's list of groups (second but last column).

bye, Dirk
 Quote

ohNoes!

Anonymous
Well I'm familiar with that (next to the "edit" button on the groups Admin page, correct?), but I'd like to actually have a list on the homepage that everyone can see. Again, the same as the "Who's Online" block. I have certain members that belong to a custom group and I'd like everyone visiting the site to be able to see who those members are.

Or am I just not following you correctly...?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by ohNoes!: but I'd like to actually have a list on the homepage that everyone can see.

In that case, you'll need some customized code ...

bye, Dirk
 Quote

ohNoes!

Anonymous
Well, anyone done this before? Have any ideas for the code?
 Quote

Status: offline

lgriffin

Forum User
Junior
Registered: 12/01/04
Posts: 24
giggly
I found a post somewhere a while back that does what I think you want. It is a block to list the members of groups (I did not write this but use it on my site, very helpful).

Put the following code in your lib-custom.php file.

Text Formatted Code
/***
* List group members (recursive) - 'List Group Members' Block
* Srikanth Bedathur v1.0 December 25, 2003
* Many thanks to Blaine Lang
*/

function phpblock_groupMembers () {
global $PHP_SELF,$_CONF, $HTTP_POST_VARS,$_TABLES, $_USER;

$checked = array ();

$retval = '<form action="' .$_CONF['site_url']. '/index.php" method="POST">';
$retval .= '<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">';
$retval .= '<tr>';
$retval .= '<td colspan="3" height="30" align="left"><font size="-2">Select Group to list members</font><br></td>';
$retval .= '</tr><tr>';
$retval .= '<td align="left" STYLE="width:55px"><b>Group:</b></td>';
$retval .= '<td colspan="2" align="left" height="25">';
$retval .= '<select name="groupid" STYLE="width:130px">';
$retval .= COM_optionList ($_TABLES['groups'],'grp_id,grp_name',$HTTP_POST_VARS['groupid']) . '</select> ';
$retval .= '</td>';
$retval .= '</tr>';
$retval .= '<tr><td colspan"2" STYLE="width:55px"> </td>';
$retval .= '<td colspan="2" align="left" width="100%" height="30" ><input type=submit name="getMemberList" value="List"></td>';
$retval .= '<tr><td align="left" valign="top" STYLE="width:55px"><b>Members: </b></td><td>';
$retval .= '<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">';

if (isset($HTTP_POST_VARS['getMemberList'])) {
       
        $groups = getMemberGroups($HTTP_POST_VARS['groupid'], $checked);
       
    $ngroups = count( $groups );
        COM_errorLOG("Num of groups found: '. $ngroups");
       
        $chkretval ="";
        $profileurl = '<a href="/users.php?mode=profile&uid=';

    if ($ngroups > 0) {
       
        $mygrouplist = implode (',' , $groups );
        $sql = "FROM {$_TABLES['users']},{$_TABLES['group_assignments']}
                        WHERE {$_TABLES['users']}.uid > 1 AND {$_TABLES['users']}.uid =
                        {$_TABLES['group_assignments']}.ug_uid AND
                        ({$_TABLES['group_assignments']}.ug_main_grp_id IN ({$mygrouplist}))";
   
        $result = DB_query ("SELECT DISTINCT username, uid " . $sql. " ORDER BY username ");
        $nrows = DB_numRows ($result);
       
       
    for ($i = 0; $i < $nrows; $i++) {
        $A = DB_fetchArray ($result);
   
        $chkretval = $chkretval.'<tr><td colspan="2" align="left"><font size="-2"> '. $profileurl. $A['uid'].'">'. $A['username'] . '</a></font></td></tr>';
        }
   
        }

        $retval .= $chkretval . '</table></td></tr>';
} else {
 $retval .= '</table></td></tr>';
}


$retval .= '</table>';
$retval .= '</form>';

return $retval;

}
 


Then create a block
Block Title - Group Members
Block Name - GroupMembers
Block Type - PHP Block
Block Fucntion - phpblock_groupMembers
(others change or set as you see fit)

I hope that helps
 Quote

Status: offline

sharon

Forum User
Junior
Registered: 11/28/04
Posts: 16
Location:Lafayette, Indiana USA
Is there a way to edit this so that only certain groups are listed to visitors?
 Quote

Status: offline

sharon

Forum User
Junior
Registered: 11/28/04
Posts: 16
Location:Lafayette, Indiana USA
I'm looking for some help editing the code so that only certain groups show. Could anyone please give me a little insight? Thank you Smile
 Quote

Status: offline

drshakagee

Forum User
Full Member
Registered: 10/01/03
Posts: 231
Where is this function: getMemberGroups ?
Yes I am mental.
 Quote

All times are EST. The time is now 11:16 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content