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

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 04:37:09 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,105
  • Total Topics: 21,213
  • Online today: 142
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 147
  • Total: 147

Roster Page

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

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

londonhogfan

===========================================================================
UPDATE:  08/24/06
===========================================================================
This has progressed quite a bit over the last 3 months.

The way this works is by creating member groups for each rank on your roster.  Then setting your members primary member group to their rank.

Click here for the post with the final code put together by JPDeni
http://www.tinyportal.net/smf/index.php?topic=5423.msg63479#msg63479
You will need to edit the ranks and remove things such as team names etc to make it work for you.  Have fun.

The finished product is on my site here...
http://www.the-rota.com/?page=30



===========================================================================
ORIGINAL POST
===========================================================================

Well this came from the "Meet the team" page thread and I wanted to start a new topic because it kinda went in two directions.

using the "STAFF PAGE" Mod code I made a few changes for my site so I could order all the member groups into a roster for my Couner-Strike clan site.

I entered the following code into an article (php) page to get this.
http://www.the-rota.com/?page=30


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

                 $groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, minPosts, onlineColor
FROM {$db_prefix}membergroups WHERE groupName = 'General'
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)
{

//Now get all the user's
$query2 = db_query("SELECT ID_GROUP, ID_MEMBER, realName, usertitle, emailAddress, hideEmail, lastLogin, location, personalText, totalTimeLoggedIn, dateRegistered, ICQ, AIM, YIM, MSN, hideEmail, emailAddress
FROM {$db_prefix}members WHERE ID_GROUP = " . $data['id'] . " ", __FILE__, __LINE__);

if(db_affected_rows() != 0)
{
echo '<table border="0" cellspacing="1" cellpadding="4" align="center" width="100%" class="bordercolor">
<tr><td colspan="12" class="titlebg">
<font size="4" face="verdana"><b>[GeN] : ' . $data['name'] . '</b></font></td></tr><tr><td rowspan="70" width="75" class="windowbg" valign="top"><br><center><img src="http://www.the-rota.com/Themes/Sullen_Madness/images/medium/rank_21.png"></center></td>';
echo '';
echo '<td class="catbg2" width="280">Alias</td>';
echo '<td class="catbg2" width="100">Name</td>';
echo '<td class="catbg2" width="145">Location</td>';
echo '<td class="catbg2" width="255">Last Active</td>';
echo '<td class="catbg2" width="155">Contact</td>';
echo '</tr><tr>';

while ($row2 = mysql_fetch_assoc($query2))
{

echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '">~RoTa~ <b><font color="' . $data['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b></font> [GeN]</font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a><td class="windowbg">' . $row2['usertitle'] . '</td>';
echo '<td class="windowbg">' . $row2['location'] . '</td>';
                                        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
//echo '<td class="windowbg">' .  timeformat($row2['dateRegistered']) . '</td>';
echo '<td class="windowbg">';

//Send email row
if($row2['hideEmail'] == 0)
echo '<a href="mailto:', $row2['emailAddress'], '"><img src="' . $settings['images_url'] . '/email_sm.gif" alt="email" /></a> ';


if($row2['ICQ'] != '')
echo '<a href="http://www.icq.com/whitepages/about_me.php?uin=' . $row2['ICQ'] . '" target="_blank"><img src="http://status.icq.com/online.gif?img=5&icq=' . $row2['ICQ'] . '" alt="' . $row2['ICQ'] . '" width="18" height="18" border="0" /></a> ';
if($row2['AIM'] != '')
echo '<a href="aim:goim?screenname=' . urlencode(strtr($row2['AIM'], array(' ' => '%20'))) . '&message=' . $txt['aim_default_message'] . '"><img src="' . $settings['images_url'] . '/aim.gif" alt="' . $row2['AIM'] . '" border="0" /></a> ';
if($row2['YIM'] != '')
echo '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row2['YIM']) . '"><img src="http://opi.yahoo.com/online?u=' . urlencode($row2['YIM']) . '&m=g&t=0" alt="' . $row2['YIM'] . '" border="0" /></a> ';
if($row2['MSN'] != '')
echo '<a href="http://members.msn.com/' . $row2['MSN'] . '" target="_blank"><img src="' . $settings['images_url'] . '/msntalk.gif" alt="' . $row2['MSN'] . '" border="0" /></a> ';
                                        if (!empty($message['member']['options']['Xfire']))
                                                echo '<a href="http://www.xfire.com/xf/modules.php?name=XFire&file=profile&uname=', $message['member']['options']['Xfire'], '" target="_blank"><img border="0" src="' . $settings['images_url'] . '/Xfire.gif"></a>';
//Send PM row
echo '<a href="' . $scripturl . '?action=pm;sa=send;u=' . $row2['ID_MEMBER'] . '"><img src="' . $settings['images_url'] . '/im_on.gif" alt="email" /></a></a>';

echo '</td>';

echo '</tr>';
}
echo '</table>';
}
}

echo'<br>';


I just copy the code and change the member group name, rank specific stuff, and logo (I use my "stars" logo, but couldn't figure out how to auto add that).

I'm very happy with it but was wondering if anyone would be willing to help me add a few things.

I'm trying to add total time online, avatar, "online/offline" button and total posts.

Does anyone know how I would add these?

Thanks,, Jacob

IchBin

As long as you have the global variables declared at the top you should be able to call everything you need. You will need to add $context to the globals though.

For instance for the avatar you could simply add something like this (of course without the php tags).
<?php
        
if (!empty($context['user']['avatar']))
                echo 
'<div>'$context['user']['avatar']['image'], '</div>';
?>

londonhogfan

#2
Alright, I tried that one, but now everyone has my avatar :D


edit:  Everyone has the avatar of the person viewing the page.

IchBin

ah.... crap. I can't remember which code it is. That is just something I remember off the top of my head. I'll have to take a closer look.

IchBin

Ok, here it is right from one of my themes. You can adjust it to your needs. Just remember to add $settings and $options to your globals.

                        // Show avatars, images, etc.?
                        if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
                                echo '
                                                                <div style="overflow: auto; width: 100%;">', $message['member']['avatar']['image'], '</div><br />';

londonhogfan

Thanks for your replies.  Here is what I'm using now.


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

                 $groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, minPosts, onlineColor
FROM {$db_prefix}membergroups WHERE groupName = 'General'
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)
{

//Now get all the user's
$query2 = db_query("SELECT ID_GROUP, ID_MEMBER, realName, avatar, usertitle, emailAddress, hideEmail, lastLogin, location, personalText, totalTimeLoggedIn, dateRegistered, ICQ, AIM, YIM, MSN, hideEmail, emailAddress
FROM {$db_prefix}members WHERE ID_GROUP = " . $data['id'] . " ", __FILE__, __LINE__);

if(db_affected_rows() != 0)
{
echo '<table border="0" cellspacing="1" cellpadding="4" align="center" width="100%" class="bordercolor">
<tr><td colspan="12" class="titlebg">
<font size="4" face="verdana"><b>[GeN] : ' . $data['name'] . '</b></font></td></tr><tr><td rowspan="70" width="75" class="windowbg" valign="top"><br><center><img src="http://www.the-rota.com/Themes/Sullen_Madness/images/medium/rank_21.png"></center></td>';
echo '';
echo '<td class="catbg2" width="280">Alias</td>';
echo '<td class="catbg2" width="100">Name</td>';
echo '<td class="catbg2" width="145">Location</td>';
echo '<td class="catbg2" width="255">Last Active</td>';
echo '<td class="catbg2" width="155">Contact</td>';
echo '</tr><tr>';

while ($row2 = mysql_fetch_assoc($query2))
{

echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '">~RoTa~ <b><font color="' . $data['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b></font> [GeN]</font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a><td class="windowbg">' . $row2['usertitle'] . '</td><td class="windowbg"';
// Show avatars, images, etc.?
                        if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
                                echo '
                                                                <div style="overflow: auto; width: 100%;">', $message['member']['avatar']['image'], '</div><br />';
echo '</td><td class="windowbg">' . $row2['location'] . '</td>';
                                        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
//echo '<td class="windowbg">' .  timeformat($row2['dateRegistered']) . '</td>';
echo '<td class="windowbg">';

//Send email row
if($row2['hideEmail'] == 0)
echo '<a href="mailto:', $row2['emailAddress'], '"><img src="' . $settings['images_url'] . '/email_sm.gif" alt="email" /></a> ';


if($row2['ICQ'] != '')
echo '<a href="http://www.icq.com/whitepages/about_me.php?uin=' . $row2['ICQ'] . '" target="_blank"><img src="http://status.icq.com/online.gif?img=5&icq=' . $row2['ICQ'] . '" alt="' . $row2['ICQ'] . '" width="18" height="18" border="0" /></a> ';
if($row2['AIM'] != '')
echo '<a href="aim:goim?screenname=' . urlencode(strtr($row2['AIM'], array(' ' => '%20'))) . '&message=' . $txt['aim_default_message'] . '"><img src="' . $settings['images_url'] . '/aim.gif" alt="' . $row2['AIM'] . '" border="0" /></a> ';
if($row2['YIM'] != '')
echo '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row2['YIM']) . '"><img src="http://opi.yahoo.com/online?u=' . urlencode($row2['YIM']) . '&m=g&t=0" alt="' . $row2['YIM'] . '" border="0" /></a> ';
if($row2['MSN'] != '')
echo '<a href="http://members.msn.com/' . $row2['MSN'] . '" target="_blank"><img src="' . $settings['images_url'] . '/msntalk.gif" alt="' . $row2['MSN'] . '" border="0" /></a> ';
                                        if (!empty($message['member']['options']['Xfire']))
                                                echo '<a href="http://www.xfire.com/xf/modules.php?name=XFire&file=profile&uname=', $message['member']['options']['Xfire'], '" target="_blank"><img border="0" src="' . $settings['images_url'] . '/Xfire.gif"></a>';
//Send PM row
echo '<a href="' . $scripturl . '?action=pm;sa=send;u=' . $row2['ID_MEMBER'] . '"><img src="' . $settings['images_url'] . '/im_on.gif" alt="email" /></a></a>';

echo '</td>';

echo '</tr>';
}
echo '</table>';
}
}

echo'<br>';


http://www.the-rota.com/?page=30

Not getting anything to show up :(  When I view the page source its just blank in that cell of the table.  Do you see what I have done wrong?

stigmartyr

Hey cool, u guys are workin on this :)  I cant wait for something like this

londonhogfan

you and every other gaming site  ;)  :up:

When its all done my life will be soo much easier.

IchBin

ok.... I'm thinking it's not going to work this way. I think an array needs to be created to process each user. I'm not sure how to write it myself. I'll see if I can't dig something up though.

londonhogfan

Quote from: IchBinâââ,¬Å¾Ã,¢ on June 01, 2006, 05:30:34 AM
ok.... I'm thinking it's not going to work this way. I think an array needs to be created to process each user. I'm not sure how to write it myself. I'll see if I can't dig something up though.

Thanks.  I appreciate you.  You always seem to be the guy willing to help everyone.