TinyPortal

Development => Block Codes => Topic started by: scope on June 14, 2006, 06:28:04 AM

Title: Member Group List
Post by: scope on June 14, 2006, 06:28:04 AM
I want a block to list members of a group.  For instance I have a block that I type in on the right hand side of my clan site for members of the clan.  http://www.digitalserialkillers.com


I want to list all members from a member group called clan.  Any ideas?
Title: Re: Member Group List
Post by: ontap on June 14, 2006, 06:45:54 AM
This may work to show a certian group in a block.

WHERE groupName = 'Enter The Group Name Here!'
(This must be the exact name of the group in your Membergroups.)

global $db_prefix, $scripturl, $txt, $user_info,$settings, $modSettings;

                 $groups = '';
// Show Group
$query = db_query("SELECT ID_GROUP, groupName, minPosts, onlineColor
FROM {$db_prefix}membergroups WHERE groupName = 'Enter The Group Name Here'
ORDER BY groupName", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{

$groups[$row['ID_GROUP']]  = array(
'id' => $row['ID_GROUP'],
'name' => $row['groupName'],
'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
);
}
mysql_free_result($query);


foreach ($groups as $id => $data)
{

$query2 = db_query("SELECT ID_GROUP, ID_MEMBER, realName, emailAddress
FROM {$db_prefix}members WHERE ID_GROUP = " . $data['id'] . " ", __FILE__, __LINE__);

if(db_affected_rows() != 0)
{
echo '<table border="0" cellspacing="0" cellpadding="2" width="100%">';
echo '<tr>';
//echo '<td class="catbg2">' . $data['name'] . '</td>';
echo '</tr>';

while ($row2 = mysql_fetch_assoc($query2))
{
echo '<tr>';
echo '<td class="windowbg"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><font color="' . $data['color'] . '">' . $row2['realName'] . '</font></a></td>';
echo '</td>';
echo '</tr>';
}
echo '</table>';
}
}
Title: Re: Member Group List
Post by: scope on June 14, 2006, 06:55:08 AM
DIdn't give a list of users, did give one of the users, but unable to resolve why it choose that specific person.
Title: Re: Member Group List
Post by: ontap on June 14, 2006, 07:00:18 AM

it will only list the users in that membergroup, is that not what your lookin for?
Title: Re: Member Group List
Post by: scope on June 14, 2006, 07:18:19 AM
yes, it only listed ONE person in that group.  IT's not even the latest person, so I have no idea why this person was even listed.
Title: Re: Member Group List
Post by: IchBin on June 14, 2006, 01:40:55 PM
Look for a post in TP support called "The Team Page.....Awesome!" or something like that. On page two Bloc posted the code for it. You could modify it to suite your needs.
Title: Re: Member Group List
Post by: Xarcell on June 16, 2006, 10:57:43 PM
http://www.tinyportal.net/smf/index.php?topic=5423.new#new