TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 349
  • Total: 349

Roster Page

Started by londonhogfan, May 31, 2006, 06:56:37 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

stigmartyr

Quote from: Bloc on June 30, 2006, 02:04:40 PM
Thats because that query doesn't consider that more groups are just merged in one variable. So if you have secondary groups with both ID=4 and ID=39, it will actually show as 4,39 in the db. Just checking for ID=4 will then fail, even if the 4 is in there.
Great.  But how do we fix this?  I cannot get the code to work for me to render anything in secondary groups either.  And My members have 1 Primary group followed by up to as many as 4 or 5 secondary groups.

bloc

Does changing this code:
WHERE mem.additionalGroups = $groupnumber
to:
WHERE FIND_IN_SET($groupnumber, mem.additionalGroups)

..work better?

Xarcell

Can you apply more than one secondary group to a member?

bloc

I haven't tested this at all, but I would think so..by something like:

WHERE (FIND_IN_SET($groupnumber, mem.additionalGroups) OR FIND_IN_SET($groupnumber2, mem.additionalGroups))

HaxXxoR

Quote from: Xarcell on June 17, 2006, 12:56:47 AM
Secondary Membergroups:

Ok, here is a very simple layout I altered it to. Basically it shows some text you want, small image or shield/medal and group members. It fits snug into a default size(170px) side block. It also has tablecell hightlighting and is flexiable with themes.

*Replace red "$groupnumber = 16;" with membergroup #.

*Replace red "SAY WHATEVER YOUR WANT HERE!" with the text you want.

*Replace red "YOUR URL" with url to the image you want. I just used my favicon for the time being.

global $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER;
global $board_info, $settings, $db_prefix;

$groupnumber = 16;
$loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['TPortal']['team']=array();

$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.additionalGroups, mem.ID_MEMBER, mem.memberName,
mem.realName,mem.lastLogin, mem.websiteTitle, mem.websiteUrl, mem.location,   
                        mem.posts,
                        them.value AS teamtext";
$select_tables = "
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
                        LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)";

// Load the member's data.
$request = db_query("
SELECT$select_columns
FROM {$db_prefix}members AS mem$select_tables
WHERE mem.additionalGroups = $groupnumber
                        OR mem.additionalGroups = 1 ORDER BY mem.memberName ASC", __FILE__, __LINE__);
$new_loaded_ids = array();
while ($row = mysql_fetch_assoc($request))
{

$avatar_width = '';
$avatar_height = '';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'name' => $row['realName'],
'posts' => $row['posts'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . $row['realName'] . '</a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],
);



}
mysql_free_result($request);



        echo '<table align="center" width="95%" cellpadding="3" cellspacing="3"><tr>
                 <td colspan="4" class="smalltext">SAY WHATEVER YOUR WANT HERE!
<hr /></td></tr>';
        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<tr>
<td width="3%" align="center" valign="middle" class="windowbg3" onmouseover="this.className=\'windowbg\'" onmouseout="this.className = \'windowbg3\'"><img src="YOUR URL" /></td>

<td width="*" valign="top" class="windowbg" style="padding: 5px;" onmouseover="this.className=\'windowbg3\'" onmouseout="this.className = \'windowbg\'">
'.$team['link'].'


    </td></tr>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
            }
        }
echo '</tr></table>';



For some reason i cant get this to work. Can someone tell me what i need to do to make it work, like what kinda block to use and stuff

Gargoyle

I'm sorry I posted in the wrong topic the first time... I meant to post in this one.. ;D

I am trying to do a second page using this code but it won't allow me to do that. I wanted to include more that one group on that page as well in a seperated list.

Can this code be used more than once and if so what variable do I need to change to make it work ??

Can it use multiple user groups ?

Thanks

Gargoyle

O'kay I have it all figured out... Sorry for the post above I was tird and not thinking right.. This is VERY useful code By the way...

I now have a Club Director Page, Club Member Page, Supporting Members Page, and a 1,000 post club page all using the same code with little tweaks to the SQL here an there.

Anyway thank a lot guys your work has really helped me out!

stigmartyr

mWUAHAHAHA!! Finally secondary groups seems to be working!!!  Hoorah!  **Goes to play**

stigmartyr

Ok I found one tiny glitch:  Administrators show up in all secondary membergrop listings, even though I just want to show that specific secondary group.  Any ideas to help me omit site admins from this roster?

bloc

Remove the "OR mem.additionalGroups = 1" from that call.

This website is proudly hosted on Crocweb Cloud Website Hosting.