TinyPortal

Development => Block Codes => Topic started by: londonhogfan on May 31, 2006, 06:56:37 PM

Title: Roster Page
Post by: londonhogfan on May 31, 2006, 06:56:37 PM
===========================================================================
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 (http://mods.simplemachines.org/index.php?mod=348)" 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 (http://www.the-rota.com).

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
Title: Re: Roster Page
Post by: IchBin on May 31, 2006, 07:11:30 PM
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>';
?>
Title: Re: Roster Page
Post by: londonhogfan on May 31, 2006, 08:15:07 PM
Alright, I tried that one, but now everyone has my avatar :D


edit:  Everyone has the avatar of the person viewing the page.
Title: Re: Roster Page
Post by: IchBin on May 31, 2006, 10:05:21 PM
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.
Title: Re: Roster Page
Post by: IchBin on May 31, 2006, 10:51:13 PM
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 />';
Title: Re: Roster Page
Post by: londonhogfan on May 31, 2006, 11:10:38 PM
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?
Title: Re: Roster Page
Post by: stigmartyr on May 31, 2006, 11:19:24 PM
Hey cool, u guys are workin on this :)  I cant wait for something like this
Title: Re: Roster Page
Post by: londonhogfan on June 01, 2006, 01:48:30 AM
you and every other gaming site  ;)  :up:

When its all done my life will be soo much easier.
Title: Re: Roster Page
Post by: 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.
Title: Re: Roster Page
Post by: londonhogfan on June 01, 2006, 02:44:35 PM
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.
Title: Re: Roster Page
Post by: stigmartyr on June 01, 2006, 05:33:35 PM
Ich is cool-beans.
Title: Re: Roster Page
Post by: stigmartyr on June 02, 2006, 01:08:52 AM
Hey LONDONHOGFAN: I was curious if you could show me just how you got the roster done like the one on: http://www.the-rota.com/index.php?page=5

I want to be able to display a table break-down of all our ranks from Operative on up to our highest ranks.
Title: Re: Roster Page
Post by: londonhogfan on June 02, 2006, 03:08:11 PM
well that was just normal HTML

the code posted here is how I got my new roster done...


  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" class="bordercolor">
<tr><td colspan="6" class="titlebg">
<font size="4" face="verdana"><b>[GeN] : ' . $data['name'] . '</b></font></td></tr><tr><td rowspan="70" width="70" class="windowbg" valign="top"><center><img src="http://www.the-rota.com/Themes/Sullen_Madness/images/medium/rank_21.png"></center></td>';
echo '<td class="catbg2" width="230">Alias</td>';
echo '<td class="catbg2" width="80">Name</td>';
echo '<td class="catbg2" width="145">Location</td>';
echo '<td class="catbg2" width="180">Last Active</td>';
echo '<td class="catbg2" width="100">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><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

you need to find the word " General " near the top and change to the exact name of the member group you want to show.  then just look through the code...  I added a rank image for each membergroup, and the tag "~RoTa~" before and position "[GeN]" after each name. so just change or delete that part.

just put the code into an article and test it.  Get everything working how you want and just copy / paste the exact same code below that one (just change the member group...)  Keep going until your done.

Hope that helps.
Title: Re: Roster Page
Post by: IchBin on June 02, 2006, 06:24:31 PM
Since I can't get this to work in an article for me (somethings wrong with my TP install) I'll post my additions here and you can test them. :)

It appears after looking more closely at this code that the avatar is already called but it is not displayed. To me it looks like you can just add another column and then in the column that you want the avatar to display you can put this code and it should show the avatar.

' . $row2['avatar'] . '
Title: Re: Roster Page
Post by: G6Cad on June 02, 2006, 06:32:04 PM
IchBin, if you need to test something you can use my testsite if you want ....

I PM the info you need if you want  8)
Title: Re: Roster Page
Post by: IchBin on June 02, 2006, 06:41:10 PM
Ok, I'll hunt you down if I need to. I can't get it to work on my working site or my test site. So something strange is going on.
Title: Re: Roster Page
Post by: stigmartyr on June 03, 2006, 02:35:46 PM
Nothing shows for me in the table when I add PHP Article.  Im not sure what I need to edit to make it work londonhogfan :( Anything I need to change?  No infoz are populating into the table.  Just a single blank row.
Title: Re: Roster Page
Post by: londonhogfan on June 07, 2006, 08:21:04 PM
did you change the membergroup name?

Are you sure there are members in that group?
Title: Re: Roster Page
Post by: IchBin on June 07, 2006, 08:36:37 PM
Did you get the avatar to work with this yet Hog?
Title: Re: Roster Page
Post by: londonhogfan on June 07, 2006, 08:45:45 PM
no.  :-\  no luck.
Title: Re: Roster Page
Post by: IchBin on June 07, 2006, 09:35:23 PM
You didn't tell me what happened on my last suggestion so I just gave up.
Title: Re: Roster Page
Post by: londonhogfan on June 07, 2006, 10:54:48 PM
oh, sorry about that.  When I put in ' . $row2['avatar'] . ' it just shows up blank in the page source.  Page looks the same with or without it.
Title: Re: Roster Page
Post by: stigmartyr on June 07, 2006, 11:12:53 PM
iCH IS on the case! ^_^
Title: Re: Roster Page
Post by: londonhogfan on June 08, 2006, 08:14:32 PM
Quote from: londonhogfan on June 07, 2006, 10:54:48 PM
oh, sorry about that.  When I put in ' . $row2['avatar'] . ' it just shows up blank in the page source.  Page looks the same with or without it.

well found the problem.  That code is working, just not on my site.  Tried it somewhere else and worked fine.  I have our forum setup to download and resize everyones avatar.  The field in the database is blank.

Any idea on where to pull that resized avatar from?
Title: Re: Roster Page
Post by: IchBin on June 08, 2006, 08:36:30 PM
I've been trying to figure it out for a while now londonghogfan. I'm just not quite understanding enough about the database calls and functions to do it. If you want to try something else out you can look at the thread titled "Meet the Team Page" in this board I think and you'll see that Bloc has created it with his own piece of code. It pulls the avatar and everything from the database using an array of sorts.... You can edit his code to suite your needs if you really want to.
Title: Re: Roster Page
Post by: scope on June 15, 2006, 04:42:16 AM
Thinks for the pointer here Ichbin..excellent.

I just want to pull the list.  I am having problems removing everything else.  I just want the names to show up, in a column and have a link to their profile like it already does.
Title: Re: Roster Page
Post by: scope on June 15, 2006, 06:15:42 AM
Took me an an hour, but I figured it out.  Also added the ability to select an ID to display when you hover over a name, soon to display steamID, as soon as I figure out how to add that into member info.

If anyone has an idea of how to remove the extra cells that are empty, let me know.

//Recruits Group
          $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 = 'Recruit'
         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, MSN
         FROM {$db_prefix}members WHERE ID_GROUP = " . $data['id'] . " ", __FILE__, __LINE__);

         if(db_affected_rows() != 0)
         {
            echo '<table width="200" border="0" cellspacing="1" cellpadding="4" align="center" class="bordercolor">
<tr>
    <td colspan="1" class="titlebg">
<font size="4" face="verdana">' . $data['name'] . '</font></td></tr>';
            
            while ($row2 = mysql_fetch_assoc($query2))
            {

               echo '<tr><td class="windowbg" height="40"><a title="' . $row2['MSN'] . '"  href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '">::[DsK]:: <font color="' . $data['color'] . '" size="1" face="verdana">' . $row2['realName'] . '</a></a><td class="windowbg">' . $row2['usertitle'] . '</td></tr>';
               }
                             echo '</table>';
            }
      }

echo'
';

http://www.digitalserialkillers.com
Located on right hand side
Title: Re: Roster Page
Post by: stigmartyr on June 15, 2006, 07:18:54 AM
Is there a way to call additional member groups into the table?  As of now I can only call primary member groups :(

I have not been able to call the 'additional' or secondary membergroups into tables.  This would be extremely helpful in creating additional roster listings with other (secondary) membergroups assigned to my members.
Title: Re: Roster Page
Post by: scope on June 15, 2006, 11:27:05 PM
I was curious of the same thing.  I will evntually want to pull a list of donators on my site.  So they get credit as a donator, not just a name to show up.
Title: Re: Roster Page
Post by: Xarcell on June 15, 2006, 11:58:20 PM
I'm having troubles getting the script to work. Where do I enter the group ID?

Also, the table cells are screwed up because you didn't close the table cell before starting a new one. You should have also span/style instead of font tag.
Title: Re: Roster Page
Post by: Xarcell on June 15, 2006, 11:59:10 PM
I can fix the html part as soon as I get the script to work.
Title: Re: Roster Page
Post by: Xarcell on June 16, 2006, 12:00:39 AM
lol, you also didn't close your link tag. Because you posted it here and not within the bbc code tags, SMF added the close url tags.
Title: Re: Roster Page
Post by: Xarcell on June 16, 2006, 12:07:28 AM
I can't test it because I can't get it to work. However try this, it should fix your table errors:

//Recruits Group
          $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 = 'Recruit'
         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, MSN
         FROM {$db_prefix}members WHERE ID_GROUP = " . $data['id'] . " ", __FILE__, __LINE__);

         if(db_affected_rows() != 0)
         {
            echo '<table width="200" border="0" cellspacing="1" cellpadding="4" align="center" class="bordercolor">
<tr>
    <td colspan="1" class="titlebg" style="font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif;">' . $data['name'] . '</td></tr>';
           
            while ($row2 = mysql_fetch_assoc($query2))
            {

               echo '<tr><td class="windowbg" height="40"><a title="' . $row2['MSN'] . '"  href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '">::[DsK]:: <span style="' . $data['color'] . '" size="1" face="verdana">' . $row2['realName'] . '</span></a></td><td class="windowbg">' . $row2['usertitle'] . '</td></tr>';
             }
                             echo '</table>';
          }
       }
Title: Re: Roster Page
Post by: stigmartyr on June 16, 2006, 12:08:23 AM
Im using an array borrowed from Londonhogfan. Ã, If you are using that code Xar, then this is where you enter Member Group name:

Ã, 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 = 'PRECEPTOR'
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" class="bordercolor">
<tr><td colspan="6" class="titlebg">
<font size="4" face="verdana"><b>=[B|C]= : ' . $data['name'] . '</b></font></td></tr><tr><td rowspan="70" width="70" class="windowbg" valign="top"><center><img src="http://black-chapter.com/images/roster/4starGEN.png"></center></td>';
echo '<td class="catbg2" width="230">Alias</td>';
echo '<td class="catbg2" width="80">Title</td>';
echo '<td class="catbg2" width="145">Location</td>';
echo '<td class="catbg2" width="180">Last Active</td>';
echo '<td class="catbg2" width="100">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'] . '">=[B|C]= <b><font color="' . $data['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b></font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a><td class="windowbg">' . $row2['usertitle'] . '</td>';
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>';



^ Whereas the membergroup above is 'PRECEPTOR'


Working Link: http://black-chapter.com/forums/index.php?page=9
Title: Re: Roster Page
Post by: Xarcell on June 16, 2006, 12:10:36 AM
I tried, this is the error I get:

Table 'gamemod.membergroups' doesn't exist
Title: Re: Roster Page
Post by: stigmartyr on June 16, 2006, 12:15:31 AM
Do you think the server ur on might be running php5?
Title: Re: Roster Page
Post by: Xarcell on June 16, 2006, 12:31:56 AM
I compared the 2 scripts and found the error. I also got it to work. Too bad it doesn't work with secondary membergroups.

Here is the fixed script. Shows membergroup, then below tag + name | user title.

* Replace CLAN TAG with your clan tag or remove.
* Replace YOUR MEMBERGROUP with the name of the membergroup you want to use.

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

//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, minPosts, onlineColor
FROM {$db_prefix}membergroups WHERE groupName = 'YOUR MEMBERGROUP'
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 width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="bordercolor">
<tr>
    <td colspan="2" class="titlebg"><span class="normaltext">' . $data['name'] . '</span></td></tr>';
           
            while ($row2 = mysql_fetch_assoc($query2))
            {

               echo '<tr><td class="windowbg" height="40"><a title="' . $row2['MSN'] . '" class="smalltext" href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '">CLAN TAG ' . $row2['realName'] . '</span></a></td><td class="windowbg"><span class="smalltext">' . $row2['usertitle'] . '</span></td></tr>';
             }
                             echo '</table>';
          }
       }


Here it is without the user title.

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

//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, minPosts, onlineColor
FROM {$db_prefix}membergroups WHERE groupName = 'YOUR MEMBERGROUP'
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 width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="bordercolor">
<tr>
    <td class="titlebg"><span class="normaltext">' . $data['name'] . '</span></td></tr>';
           
            while ($row2 = mysql_fetch_assoc($query2))
            {

               echo '<tr><td class="windowbg" style="padding: 5px;"><a title="' . $row2['MSN'] . '" class="normaltext" href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '">CLAN TAG ' . $row2['realName'] . '</span></a></td></tr>';
             }
                             echo '</table>';
          }
       }


Maybe I should also add a cell that shows a icon for everyone in that group. A "clan shield" or "medal" so to speak.

Title: Re: Roster Page
Post by: Xarcell on June 16, 2006, 12:36:55 AM
Here is the code if you want to add a clan shield/medal before your names.

* Replace CLAN TAG with your clan tag or remove.
* Replace YOUR MEMBERGROUP with the name of the membergroup you want to use.
* Replace CLANSHIELD.jpg with a small image you want to use.

  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 = 'YOUR MEMBERGROUP'
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 width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="bordercolor">
<tr>
    <td colspan="2" class="titlebg"><span class="normaltext">' . $data['name'] . '</span></td></tr>';
           
            while ($row2 = mysql_fetch_assoc($query2))
            {

               echo '<tr><td class="windowbg2" align="center" valign="middle"><img src="' . $settings['images_url'] . '/CLANSHIELD.jpg" /></td><td class="windowbg" style="padding: 5px;"><a title="' . $row2['MSN'] . '" class="smalltext" href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '">CLAN TAG ' . $row2['realName'] . '</span></a></td></tr>';
             }
                             echo '</table>';
          }
       }
Title: Re: Roster Page
Post by: Xarcell on June 16, 2006, 12:41:00 AM
BTW, I also fixed the script so that it doesn't show sessionID in link.

Anyone know how to get it to show secondary membergroups?
Title: Re: Roster Page
Post by: stigmartyr on June 16, 2006, 12:58:32 AM
I copied your code on the most bottom post, and I get this error:


Parse error: parse error, unexpected T_STRING in /home/blacsto1/public_html/forums/Sources/Load.php(1607) : eval()'d code(45) : eval()'d code on line 11


Title: Re: Roster Page
Post by: Xarcell on June 16, 2006, 01:12:55 AM
Try it now...
Title: Re: Roster Page
Post by: scope on June 16, 2006, 05:50:00 AM
I receive the following error: Unknown column 'STEAMID' in 'field list'
File: /home/content/t/e/c/tech7170451/html/smf/Sources/Load.php(1607) : eval()'d code(34) : eval()'d code
Line: 25

How do I find the Field list?
Title: Re: Roster Page
Post by: londonhogfan on June 16, 2006, 08:44:23 PM
seems like I had this one working with secondary member groups.  I will try to look at it this weekend.  For now I'm just using the meet the team script to pull secondary groups for a donors page.

here is my page...
http://www.the-rota.com/index.php?page=10

here was the code that uses secondary groups.

note:  you will need to change
$groupnumber = 19;
to whatever group number your wanting to use.


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

$groupnumber = 19;
$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="5" cellspacing="5"><tr>
                 <td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>Meet the ~RoTa Donors~!</h2>
<span class="smalltext">These are the members currently donating funds to help keep the server / web-site going.</span><br />
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';
        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<tr><td valign="middle" width="110">'.$team['avatar']['image'].'</td>
<td valign="top" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;"><b>'.$team['link'].'</b></h2>
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td></tr>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"></td></tr><tr>';
            }
        }
echo '</tr></table>';
Title: Re: Roster Page
Post by: Xarcell on June 16, 2006, 10:53:41 PM
OMG, the script works!

Thanks alot Lon.
Title: Re: Roster Page
Post by: Xarcell on June 16, 2006, 10:54:07 PM
If anyone needs help with making different layouts, let me know.
Title: Re: Roster Page
Post by: Xarcell on June 17, 2006, 12:16:36 AM
I'm experimenting with different layouts. How do you show how many are in that group?
Title: Re: Roster Page
Post by: 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>';
Title: Re: Roster Page
Post by: scope on June 24, 2006, 04:14:00 AM
OK, I have my groups showing and the tables fixed.  Awesome job guys.  I did a search on secondary member groups, but found like 3 or 4 links.  Here is my question, I want to display a secondary group(like mentioned above, the donators group) where the primary group is listed on post.  How can I add that?
Title: Re: Roster Page
Post by: cubby61 on June 30, 2006, 08:20:36 AM
For some reason Xarcell's code doesn't bring back the entire list for me.  It brings back only those users who only have a single secondary group.  Those who have multiple secondary groups are omitted.  Is there a way to have this search on the Primary group instead?
Title: Re: Roster Page
Post by: 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.
Title: Re: Roster Page
Post by: stigmartyr on June 30, 2006, 06:49:36 PM
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.
Title: Re: Roster Page
Post by: bloc on July 01, 2006, 12:01:00 AM
Does changing this code:
WHERE mem.additionalGroups = $groupnumber
to:
WHERE FIND_IN_SET($groupnumber, mem.additionalGroups)

..work better?
Title: Re: Roster Page
Post by: Xarcell on July 01, 2006, 02:30:54 AM
Can you apply more than one secondary group to a member?
Title: Re: Roster Page
Post by: bloc on July 01, 2006, 08:21:45 AM
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))
Title: Re: Roster Page
Post by: HaxXxoR on July 02, 2006, 09:48:32 PM
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
Title: Re: Roster Page
Post by: Gargoyle on July 03, 2006, 02:50:01 AM
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
Title: Re: Roster Page
Post by: Gargoyle on July 03, 2006, 03:41:03 PM
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!
Title: Re: Roster Page
Post by: stigmartyr on July 04, 2006, 12:56:38 AM
mWUAHAHAHA!! Finally secondary groups seems to be working!!!  Hoorah!  **Goes to play**
Title: Re: Roster Page
Post by: stigmartyr on July 04, 2006, 01:08:48 AM
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?
Title: Re: Roster Page
Post by: bloc on July 04, 2006, 01:11:35 PM
Remove the "OR mem.additionalGroups = 1" from that call.
Title: Re: Roster Page
Post by: stigmartyr on July 08, 2006, 05:13:19 AM
Works like a charm bloc.  I lub you man.  My next kid is gonna be named bloc.
Title: Re: Roster Page
Post by: IchBin on July 08, 2006, 05:29:38 AM
I think you should go with Bjorn. :D
Title: Re: Roster Page
Post by: Techdomain on July 08, 2006, 06:06:14 AM
calling your kid bloc would suck if your last name was head or something!!! :P
Title: Re: Roster Page
Post by: stigmartyr on July 08, 2006, 11:30:43 AM
http://black-chapter.com/forums/index.php?page=19

I made an extensive roster system now, with tons of potential secondary member groups.  It works great for putting people in different tables while keeping their Primary Account as is.

This is JUST the tool we needed :)  If there was one last touch it would be to modify what vitals show in their mini-bio.  Locations are less important that their custom titles, for example.
Title: Re: Roster Page
Post by: londonhogfan on July 09, 2006, 03:25:50 AM
Thats kinda what Im doing with mine.

I have a main roster for our entire clan.
http://www.the-rota.com/?page=30

Then a "meet the team" style page for each team.

[SRB]
http://www.the-rota.com/?page=48

[STA]
http://www.the-rota.com/?page=49

[MFR]
http://www.the-rota.com/?page=50
Title: Re: Roster Page
Post by: Gargoyle on July 09, 2006, 03:19:10 PM
Very nice!! I like the main rooster page a lot. Did you have to double up the code to get that to work?? Just curious how you coded that one is all.. ;D
Title: Re: Roster Page
Post by: stigmartyr on July 10, 2006, 06:54:29 AM
Ive reverted to using alot more java menus since the new security features with flash.  Using flash for menus sux now cuz it makes u click to interact with the flash, and then u have to click again to make a choice.

Xara Webstyle rox
Title: Re: Roster Page
Post by: stigmartyr on July 10, 2006, 05:30:23 PM
@ BLOC - I have but one more small tweak I need ur help with.

I would like to change what info is displayed about members.  ATM, it shows the following profile tables:

Last seen:
Posts:
Location:
Online Status:
Personal Text:

______________________________


I want to display the following relevant info:

Custom Title:
Primary Member Group:
( because on my TP, members RANKS are their primary member group.  So I want it to display their rank if possible).
KARMA:
Last seen:
Online Status:
Personal Text:



_____________________________


Can you tell me what code to change?  I did at least try to do this on my own before asking, but I wasnt successful.  My php skills are dangerous at best :P
Title: Re: Roster Page
Post by: bloc on July 10, 2006, 08:02:37 PM
Sure, no problem...could you post what code you use now - for one membergroup? or is it a straight copy from this topic? In case : which post?

There might be some slight differences. :)
Title: Re: Roster Page
Post by: stigmartyr on July 10, 2006, 09:07:01 PM
Ill post the code that I use so you can edit it, because I removed the line that displays all admins on the page.  SO we can start from here (code pasted below) and go from there :)

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

$groupnumber = 49;
$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 FIND_IN_SET($groupnumber, mem.additionalGroups)
                        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="5" cellspacing="5"><tr>
                 <td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>DELTA Force</h2>
<span class="smalltext">(DEU SOC) Darknight Expeditionary Unit: Special Operations Capable.</span><br />
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';
        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<tr><td valign="middle" width="110">'.$team['avatar']['image'].'</td>
<td valign="top" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;"><b>'.$team['link'].'</b></h2>
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td></tr>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"></td></tr><tr>';
            }
        }
echo '</tr></table>';
Title: Re: Roster Page
Post by: bloc on July 13, 2006, 08:25:28 PM
Try this one:

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

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

// get the name of the group
$request = db_query("
                        SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if($mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupname=$row[0];
mysql_free_result($request);
    }

$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.usertitle, mem.karmaBad, mem.karmaGood,
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 FIND_IN_SET($groupnumber, mem.additionalGroups)
             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'],
'usertitle' => $row['usertitle'],
'name' => $row['realName'],
'groupname' = $groupname;
'posts' => $row['posts'],
'karmabad' => $row['karmaBad'],
'karmagood' => $row['karmaGood'],
'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="5" cellspacing="5"><tr>
                 <td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>DELTA Force</h2>
<span class="smalltext">(DEU SOC) Darknight Expeditionary Unit: Special Operations Capable.</span><br />
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';
        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<tr><td valign="middle" width="110">'.$team['avatar']['image'].'</td>
<td valign="top" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;"><b>'.$team['link'].'</b></h2>
<b>Custom title</b>: '.$team['usertitle'].'<br />
<b>Rank</b>: '.$team['groupname'].'<br />
<b>Karma</b>: + '.$team['karmagood'].' | - '.$team['karmabad'].'
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

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


I just used karma good & bad.
Title: Re: Roster Page
Post by: stigmartyr on July 13, 2006, 08:41:46 PM
Quote from: Bloc on July 13, 2006, 08:25:28 PM
Try this one:

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

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

// get the name of the group
$request = db_query("
                        SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if($mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupname=$row[0];
mysql_free_result($request);
    }

$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.usertitle, mem.karmaBad, mem.karmaGood,
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 FIND_IN_SET($groupnumber, mem.additionalGroups)
             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'],
'usertitle' => $row['usertitle'],
'name' => $row['realName'],
'groupname' = $groupname;
'posts' => $row['posts'],
'karmabad' => $row['karmaBad'],
'karmagood' => $row['karmaGood'],
'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="5" cellspacing="5"><tr>
                 <td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>DELTA Force</h2>
<span class="smalltext">(DEU SOC) Darknight Expeditionary Unit: Special Operations Capable.</span><br />
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';
        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<tr><td valign="middle" width="110">'.$team['avatar']['image'].'</td>
<td valign="top" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;"><b>'.$team['link'].'</b></h2>
<b>Custom title</b>: '.$team['usertitle'].'<br />
<b>Rank</b>: '.$team['groupname'].'<br />
<b>Karma</b>: + '.$team['karmagood'].' | - '.$team['karmabad'].'
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

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


I just used karma good & bad.

Hi Bloc,

Im getting the follow error using that code:

Parse error: parse error, unexpected T_STRING in /home/blacsto1/public_html/forums/Sources/Load.php(1607) : eval()'d code(45) : eval()'d code on line 7
Title: Re: Roster Page
Post by: bloc on July 13, 2006, 10:58:28 PM
ahh..2 small typos ::)

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

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

// get the name of the group
$request = db_query("
                        SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if($mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupname=$row[0];
mysql_free_result($request);
    }

$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.usertitle, mem.karmaBad, mem.karmaGood,
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 FIND_IN_SET($groupnumber, mem.additionalGroups)
             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'],
'usertitle' => $row['usertitle'],
'name' => $row['realName'],
'groupname' => $groupname,
'posts' => $row['posts'],
'karmabad' => $row['karmaBad'],
'karmagood' => $row['karmaGood'],
'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="5" cellspacing="5"><tr>
                 <td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>DELTA Force</h2>
<span class="smalltext">(DEU SOC) Darknight Expeditionary Unit: Special Operations Capable.</span><br />
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';
        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<tr><td valign="middle" width="110">'.$team['avatar']['image'].'</td>
<td valign="top" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;"><b>'.$team['link'].'</b></h2>
<b>Custom title</b>: '.$team['usertitle'].'<br />
<b>Rank</b>: '.$team['groupname'].'<br />
<b>Karma</b>: + '.$team['karmagood'].' | - '.$team['karmabad'].'
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td></tr>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"></td></tr><tr>';
            }
        }
echo '</tr></table>';
Title: Re: Roster Page
Post by: stigmartyr on July 13, 2006, 11:48:22 PM
*eXCITED*


Thanks for your time with this bloc.Ã,  But I am now getting this error:

Fatal error: Call to undefined function: () in /home/blacsto1/public_html/forums/Sources/Load.php(1607) : eval()'d code(45) : eval()'d code on line 15




I have double checked very carefully to be sure Im not wasting ur time..
Title: Re: Roster Page
Post by: bloc on July 14, 2006, 12:36:17 AM
hm..strange. let me check the original code for aminute.
Title: Re: Roster Page
Post by: bloc on July 14, 2006, 12:41:42 AM
 :uglystupid2: another typo...this works as it should:

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

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

// get the name of the group
$request = db_query("
                        SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupname=$row[0];
mysql_free_result($request);
    }

$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.usertitle, mem.karmaBad, mem.karmaGood,
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 FIND_IN_SET($groupnumber, mem.additionalGroups)
             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'],
'usertitle' => $row['usertitle'],
'name' => $row['realName'],
'groupname' => $groupname,
'posts' => $row['posts'],
'karmabad' => $row['karmaBad'],
'karmagood' => $row['karmaGood'],
'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="5" cellspacing="5"><tr>
                 <td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>DELTA Force</h2>
<span class="smalltext">(DEU SOC) Darknight Expeditionary Unit: Special Operations Capable.</span><br />
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';
        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<tr><td valign="middle" width="110">'.$team['avatar']['image'].'</td>
<td valign="top" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;"><b>'.$team['link'].'</b></h2>
<b>Custom title</b>: '.$team['usertitle'].'<br />
<b>Rank</b>: '.$team['groupname'].'<br />
<b>Karma</b>: +'.$team['karmagood'].' | -'.$team['karmabad'].'<br />
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td></tr>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"></td></tr><tr>';
            }
        }
echo '</tr></table>';
Title: Re: Roster Page
Post by: stigmartyr on July 14, 2006, 12:57:43 AM
Woohoo!!!Ã,  Thanks bloc! :D :D :D

Its work great now.Ã,  Very very nice.Ã,  One small question about the RANK field?Ã,  It repeats the RANK as being the secondary group (in this case the person's squad), whereas Im trying to call their forums PRIMARY membergroup (which is that persons rank).Ã,  On my site, ur RANK is ur Primary Membergroup, and all others are the 'additional membergroups'

Is there something I should type to make this line show forums Primary Accounts? :

<b>Rank</b>: '.$team['groupname'].'<br />



Title: Re: Roster Page
Post by: londonhogfan on August 15, 2006, 07:19:37 AM
is there a limit on how much will go in the article?

or maybe the amount of seperate calls (don't know the terminology)

I use the following code...

///////////////
//General
//////////////

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, cs_stats, css_stats, 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="5" align="center" class="bordercolor">
<tr><td colspan="7" class="catbg">
<font size="4" face="verdana"><b>' . $data['name'] . '</b></font></td></tr><tr><td rowspan="70" width="85" class="profilebg" valign="top"><center><img src="' . $settings['images_url'] . '/medium/rank_21.gif"></center></td>';
echo '<td class="catinfo" width="25"></td>';
                                echo '<td class="catinfo" width="245"><b>GAMING ALIAS</b></td>';
echo '<td class="catinfo" width="130"><b>NAME</b></td>';
echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
echo '<td class="catinfo" width="100"><b>PSYCHOSTATS</b></td>';
echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';

while ($row2 = mysql_fetch_assoc($query2))
{
                                        echo '<td class="windowbg2 height="40"><img src="http://www.the-rota.com/Themes/default/images/flags/' . $row2['location'] . '.png" alt="' . $row2['location'] . '"></td>';
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '">-RoTa- Gen|<b><font color="' . $data['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b></font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . $row2['usertitle'] . '</td>';
                                        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
echo '<td class="windowbg2" align="center">';
if($row2['cs_stats'] != '')
echo '<a href="' . $row2['cs_stats'] . '" target="_blank"><img src="' . $settings['images_url'] . '/cs_stats.gif" alt="CS 1.6 Stats" border="0" /></a> ';
if($row2['css_stats'] != '')
echo '<a href="' . $row2['css_stats'] . '" target="_blank"><img src="' . $settings['images_url'] . '/css_stats.gif" alt="CS:Source Stats" border="0" /></a> ';
echo '</td><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> ';
//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><br>';
}
}


and I duplicate it for each rank on my roster page.  It lets me do it 14 times but if I do it more than that it gives me the following error...

Quote

Parse error: syntax error, unexpected $end in /home/user/public_html/Sources/Load.php(1619) : eval()'d code(45) : eval()'d code on line 1107


Any Idea what would fix this?
Title: Re: Roster Page
Post by: bloc on August 15, 2006, 01:02:25 PM
ouch..that will give a large amount of db calls. You be much better off using a code that load in all the users in all the groups first time, and rather sort them into their groups/ranks afterwards.
Title: Re: Roster Page
Post by: londonhogfan on August 15, 2006, 02:42:45 PM
is there a way to get it to work until I do that?  I really have no idea how to change the code because I have just pieced things together.
Title: Re: Roster Page
Post by: JPDeni on August 15, 2006, 03:46:50 PM
There is a maximum length to an article, as defined in the database itself. The TEXT field type has a maximum of 65535 characters. What you posted above has 4626 characters and 14 of them would have 64764 characters. One more takes you over the limit.

You could go into the database and change the field type to MEDIUMTEXT, which allows 16777215 characters, or LONGTEXT, which allows 4294967295 characters. But I wouldn't suggest doing that. It would be better if you did just one call to the database for everything and sorted it out later, like Bloc suggested.
Title: Re: Roster Page
Post by: londonhogfan on August 16, 2006, 03:03:40 PM
Thanks that worked.
http://www.the-rota.com/?page=30

If I knew how to do it any other way I would.
Title: Re: Roster Page
Post by: bloc on August 16, 2006, 06:07:56 PM
This is something the future Team Page module will be good for..but its not finished I am afraid.
Title: Re: Roster Page
Post by: londonhogfan on August 16, 2006, 07:06:25 PM
Yes, I have had such luck with TinyPortal.

I started this topic and it has helped me soo much in my community.

same for the "Awesome... Meet the Team" and "pre-formatted post" topics.


Thanks Bloc for such a great tool.
Title: Re: Roster Page
Post by: JPDeni on August 20, 2006, 05:33:38 AM
This has been bothering me and I need to see if I can fix it for you. A couple of questions first. First, are the ranks on the roster page based on the number of posts? Second, it looks like the graphic is assigned as part of the group definition. Is that correct?

I think I can get the whole thing with just one database call. :)
Title: Re: Roster Page
Post by: knat on August 20, 2006, 10:36:11 AM
I used Bloc's code and it looks nice.. but it only shows me one or two members depending on what membergroup i want it to show..

Edit: Ohh nm i found out it shows additional membergroup

What if i want to show all members of a primary membergroup using the layout from Bloc's code..

Can that be done ?? With the karma, offline/online etc etc
Title: Re: Roster Page
Post by: londonhogfan on August 21, 2006, 02:52:54 PM
Quote from: JPDeni on August 20, 2006, 05:33:38 AM
This has been bothering me and I need to see if I can fix it for you. A couple of questions first. First, are the ranks on the roster page based on the number of posts? Second, it looks like the graphic is assigned as part of the group definition. Is that correct?

I think I can get the whole thing with just one database call. :)

The membergroups are primary membergroups - non post based.  The images are the same as the "stars" from the membergroup.

I appreciate your offer to do this.
Title: Re: Roster Page
Post by: JPDeni on August 21, 2006, 03:24:30 PM
I'm trying to figure out if there's an internal way to sort the groups by the order you want them to appear. If they were post-based, it would be easy. Did you add them in the same order as you display them, so that "General" is group 1, "Brigadier General" is group 2, etc?

knat, I'm not sure what you want and how it's any different from what is already here.
Title: Re: Roster Page
Post by: knat on August 21, 2006, 06:08:59 PM
Quote from: JPDeni on August 21, 2006, 03:24:30 PM
knat, I'm not sure what you want and how it's any different from what is already here.

I want a page like the Smf Staff Page Mod

To show a single member group but in the layout like Bloc's code with the primary membergroup..

On the SMF staff page it dont show Karma, Secondary membergroup, offline/online Etc.

I hope this explains it

I want what Bloc has posted in this thread, just for a single "Primary" membergroup of my choise

Possible ?
Title: Re: Roster Page
Post by: JPDeni on August 21, 2006, 06:13:12 PM
It's probably possible. Anything that's in the database is possible. :)

Right now I'm focusing more on getting the info from the database. If there are things that are being displayed that you don't want, delete them from the code.
Title: Re: Roster Page
Post by: londonhogfan on August 21, 2006, 06:24:49 PM
no they have been added in as I went.  We started with only a few ranks and have grown into a full army. :D

I have wondered if there way a way to make this into a mod and just have a text box in an admin panel somewhere where the groups could just be listed out in order from top to bottom.

Like:
19, 5, 16, 14, etc, etc,

I really don't know how everything works though.  I know only enought to make my website work really hard :D
Title: Re: Roster Page
Post by: JPDeni on August 21, 2006, 06:52:40 PM
Okay, well, that means we'll need to define it in the script, which is okay, but I was hoping the database would do the work for me. :)

I don't know anything at all about making mods. I'm pretty new to the whole SMF/TP thing. I just have an idea about php programming. Someone else can do the fancy stuff.

I'll think a bit more on this and see if I can work it out. It's just that the idea of that many calls to the database makes my blood run cold. :)
Title: Re: Roster Page
Post by: knat on August 21, 2006, 07:27:46 PM
Quote from: JPDeni on August 21, 2006, 06:13:12 PM
It's probably possible. Anything that's in the database is possible. :)

Right now I'm focusing more on getting the info from the database. If there are things that are being displayed that you don't want, delete them from the code.

Sorry, i dont want to highjack this thread.. but i found a better way of explaining  :o

I would like to have the code that Bloc posted in this thread (It shows all the members that have a specific secondary usergroup)

I just want it to show all members of a specific Primary membergroup.. but with the same layout/information that Bloc's code displays.  Can this be done by moderating Blocs code ?? Im not really good at coding !

thanks for trying to help me out !  :) ..oO( Why is there no karma system on this board ?)
Title: Re: Roster Page
Post by: londonhogfan on August 21, 2006, 07:32:51 PM
Quote from: knat on August 21, 2006, 07:27:46 PM
Quote from: JPDeni on August 21, 2006, 06:13:12 PM
It's probably possible. Anything that's in the database is possible. :)

Right now I'm focusing more on getting the info from the database. If there are things that are being displayed that you don't want, delete them from the code.

Sorry, i dont want to highjack this thread.. but i found a better way of explaining  :o

I would like to have the code that Bloc posted in this thread (It shows all the members that have a specific secondary usergroup)

I just want it to show all members of a specific Primary membergroup.. but with the same layout/information that Bloc's code displays.  Can this be done by moderating Blocs code ?? Im not really good at coding !

thanks for trying to help me out !  :) ..oO( Why is there no karma system on this board ?)

you should check out the other topic

its called "Awesome... Meet the Team Page (http://www.tinyportal.net/smf/index.php?topic=3931.0)"
Think it is covered there.
Title: Re: Roster Page
Post by: knat on August 21, 2006, 07:39:00 PM
Thanks alot  :D i will try it out right away..   ;)
Title: Re: Roster Page
Post by: JPDeni on August 21, 2006, 10:24:41 PM
Okay, londonhogfan (I always try to read that as "London fog ..." and then realize I'm wrong because you wouldn't be a "fog han."  :) )

This isn't done, but I don't have any way to test it myself, so I'm going to ask you to try out my intermediate step. I don't normally post code to anything that I haven't tested first. No doubt there'll be a missing semi-colon some place.   :uglystupid2: But we'll give it a try.

This code should replace those fourteen repeats of the code you have already and do everything in a loop. Instead of the 28 calls to the database you have now, this will use only 15. Too many still, but on the right track. I hope.  :) Aside from a probable missing semi-colon, the thing that most concerns me is the graphics. If you end up with missing images for your insignia, check the properties for the image -- right-click the red x where the graphic is supposed to be and select "Properties" -- and tell me what it says for the name of the image. Of course, let me know any error messages you get.

I was wrong before, though. I can't get this in one call to the database. But I think I can get it in two.  ;D

Put the code below into a new php page (don't overwrite the one that's working!!)
global $db_prefix, $scripturl, $txt, $settings, $options;


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces. (I notice that "Major" is missing.)
$rankorder = array(
  'General',
  'Brigadier General',
  'Colonel',
  'Lieutenant Colonel',
  'Captain',
  '1st Lieutenant',
  'Sergeant Major',
  'First Sergeant',
  'Master Sergeant',
  'Staff Sergeant',
  'Sergeant',
  'Corporal',
  'Lance Corporal',
  'Private First Class',
  'Private'
);

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2)
  );
}
mysql_free_result($query);

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

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/medium/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="25"></td>';
      echo '<td class="catinfo" width="245"><b>GAMING ALIAS</b></td>';
      echo '<td class="catinfo" width="130"><b>NAME</b></td>';
      echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="100"><b>PSYCHOSTATS</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
        echo '<td class="windowbg2 height="40"><img src="http://www.the-rota.com/Themes/default/images/flags/' . $row2['location'] . '.png" alt="' . $row2['location'] . '"></td>';
        echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '">-RoTa- Gen|<b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b></font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . $row2['usertitle'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        if($row2['cs_stats'] != '')
          echo '<a href="' . $row2['cs_stats'] . '" target="_blank"><img src="' . $settings['images_url'] . '/cs_stats.gif" alt="CS 1.6 Stats" border="0" /></a> ';
        if($row2['css_stats'] != '')
          echo '<a href="' . $row2['css_stats'] . '" target="_blank"><img src="' . $settings['images_url'] . '/css_stats.gif" alt="CS:Source Stats" border="0" /></a> ';
        echo '</td><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> ';

//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><br>';
  }
}
Title: Re: Roster Page
Post by: londonhogfan on August 22, 2006, 02:36:21 AM
it just comes back with internal server error.

http://www.the-rota.com/index.php?page=64
Title: Re: Roster Page
Post by: JPDeni on August 22, 2006, 02:57:06 AM
worse than I expected. Back to the drawing board.

Edited to add:

Could you try it again?  Use the same page that you used before, but delete all the code in it and replace it. I've found that there are problems if you create a php page and then immediately post the code in it. It works better if you create it, save it, then edit it and paste the code.

I didn't have any problem with it, except that I don't seem to have some of the same fields in my members database that you do, so it stopped at that point.
Title: Re: Roster Page
Post by: londonhogfan on August 22, 2006, 05:52:53 PM
ok.  Go check it out when you can.

I removed everything in the rank structure except "General"

Do I need to do anything with...

$groups = '';

I appreciate you taking time to help with this.  This is something I have seen Many TP Users have on their site.
Title: Re: Roster Page
Post by: JPDeni on August 22, 2006, 07:10:37 PM
Well, that didn't work, did it? LOL

Okay....

QuoteDo I need to do anything with...

$groups = '';
No. That's just initializing the array variable. Telling the script that we're going to use it, and to start we want nothing in there.

I think I see one major boo-boo. Let's try this again. One little change, actually, could make a huge difference.

Change
foreach ($rankorder as $rank => $order)
to
foreach ($rankorder as $rank)

:uglystupid2:

I'll change it in the original code, too.
Title: Re: Roster Page
Post by: londonhogfan on August 22, 2006, 07:29:06 PM
wow. that worked.

only things I notice that would cause a problem.  The "game alias" has their rank.  I manually added those using the code.  So the code used now has.

-RoTa- Gen| '[their name]'

anyway to change the tag for each one to show their correct rank.  I could create a new field using the custom profiles mod to make a new field (only editiable by me) to put their rank in there.  only other thing I see is the images don't show up.

-Jacob
Title: Re: Roster Page
Post by: JPDeni on August 22, 2006, 07:47:02 PM
That's whole lot better!  ;D Even worse than forgetting a semi-colon. Oh, well. Fixed now.  :)

QuoteSo the code used now has.

-RoTa- Gen| '[their name]'

I see. It's not a problem. We can just add that in. No need to add a new field, unless you're going to use it elsewhere.

At the beginning, you can set up the abbreviations, like this:


$abbrev = array(
  'General' => 'Gen',
  'Brigadier General' => 'BGen',
  'Colonel' => 'Col',
  'Lieutenant Colonel' => 'LtCol',
  'Captain' => 'Cap',
  '1st Lieutenant' => '1stLt',
  'Sergeant Major' => 'SgtMaj',
  'First Sergeant' => '1stSgt',
  'Master Sergeant' => 'MSgt',
  'Staff Sergeant' => 'SSgt',
  'Sergeant' => 'Sgt',
  'Corporal' => 'Cpl',
  'Lance Corporal' => 'LCpl',
  'Private First Class' => 'PFC',
  'Private'  => 'Pvt'
);


Then, where you have

$row2['ID_MEMBER'] . '">-RoTa- Gen|<b><font color="' .[/quote]

use

[code]$row2['ID_MEMBER'] . '">-RoTa- ' . $abbrev[$rank] . '|<b><font color="' .


As for the images....

Try changing

    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2)
to
    'stars' => empty($row['stars']) ? '' : $row['stars']

That was really a guess as to how things are set up and I still don't know if it's right. We may need to create another array instead of pulling them from the database.[/code]
Title: Re: Roster Page
Post by: londonhogfan on August 22, 2006, 09:29:45 PM
this is what I have right now...


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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces. (I notice that "Major" is missing.)
$abbrev = array(
$rankorder = array(
  'General' => 'Gen',
  'Brigadier General' => 'BGen',
  'Colonel' => 'Col',
  'Lieutenant Colonel' => 'LtCol',
  'Captain' => 'Cap',
  '1st Lieutenant' => '1stLt',
  'Sergeant Major' => 'SgtMaj',
  'First Sergeant' => '1stSgt',
  'Master Sergeant' => 'MSgt',
  'Staff Sergeant' => 'SSgt',
  'Sergeant' => 'Sgt',
  'Corporal' => 'Cpl',
  'Lance Corporal' => 'LCpl',
  'Private First Class' => 'PFC',
  'Private'  => 'Pvt'
);

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
'stars' => empty($row['stars']) ? '' : $row['stars'],
  );
}
mysql_free_result($query);

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

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/medium/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="25"></td>';
      echo '<td class="catinfo" width="245"><b>GAMING ALIAS</b></td>';
      echo '<td class="catinfo" width="130"><b>NAME</b></td>';
      echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="100"><b>PSYCHOSTATS</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
        echo '<td class="windowbg2 height="40"><img src="http://www.the-rota.com/Themes/default/images/flags/' . $row2['location'] . '.png" alt="' . $row2['location'] . '"></td>';
        echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . [code]$row2['ID_MEMBER'] . '">-RoTa- ' . $abbrev[$rank] . '|<b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b></font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . $row2['usertitle'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        if($row2['cs_stats'] != '')
          echo '<a href="' . $row2['cs_stats'] . '" target="_blank"><img src="' . $settings['images_url'] . '/cs_stats.gif" alt="CS 1.6 Stats" border="0" /></a> ';
        if($row2['css_stats'] != '')
          echo '<a href="' . $row2['css_stats'] . '" target="_blank"><img src="' . $settings['images_url'] . '/css_stats.gif" alt="CS:Source Stats" border="0" /></a> ';
        echo '</td><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> ';

//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><br>';
  }
}


I will re-try the edits after work (couple hours) to see if I just entered them wrong.

you seem to know what your doing and there is something I have been wanting to add to this for a long time, but don't have the know how...

Our clan is setup by military (marine) ranks.  We have near 60 members now and we are split into 3 teams.  [MFR], [SRB], and [STA]  I have not found a way to put these on the roster so far. 

Our game names are actually -RoTa- BGen|Achilles [SRB] but I can't get the team tag on there.  The only ones that do not use the team tag are the Generals.  Is there a way to make it so

if they have a secondary rank of
[SRB] (group#32)
[STA] (group#33)
[MFR] (group#34)
it would add it to the back of their name.  (if not a member of one of those groups it would be left blank)

Thanks for your time.

-Jacob[/code]
Title: Re: Roster Page
Post by: JPDeni on August 22, 2006, 11:36:14 PM
I made a mistake. Sorry. The beginning of it needs to look like this:

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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces. (I notice that "Major" is missing.)
$rankorder = array(
  'General',
  'Brigadier General',
  'Colonel',
  'Lieutenant Colonel',
  'Captain',
  '1st Lieutenant',
  'Sergeant Major',
  'First Sergeant',
  'Master Sergeant',
  'Staff Sergeant',
  'Sergeant',
  'Corporal',
  'Lance Corporal',
  'Private First Class',
  'Private'
);
$abbrev = array(
'General' => 'Gen',
  'Brigadier General' => 'BGen',
  'Colonel' => 'Col',
  'Lieutenant Colonel' => 'LtCol',
  'Captain' => 'Cap',
  '1st Lieutenant' => '1stLt',
  'Sergeant Major' => 'SgtMaj',
  'First Sergeant' => '1stSgt',
  'Master Sergeant' => 'MSgt',
  'Staff Sergeant' => 'SSgt',
  'Sergeant' => 'Sgt',
  'Corporal' => 'Cpl',
  'Lance Corporal' => 'LCpl',
  'Private First Class' => 'PFC',
  'Private'  => 'Pvt'
);

$groups = '';


That should take care of your error. (I'll go fix it in my previous post. I guess I got distracted when I was posting and didn't finish the editing.)

Once that's done, I'd like to get the images taken care of. The teams shouldn't be a problem, especially if we don't have to worry about grouping them by teams.
Title: Re: Roster Page
Post by: londonhogfan on August 24, 2006, 06:15:56 AM
ok.  Its working now.  I am amazed at what someone that knows PHP can do.

The stars are still not showing.

have you had a chance to look at the team stuff?
Title: Re: Roster Page
Post by: JPDeni on August 24, 2006, 01:14:53 PM
QuoteI am amazed at what someone that knows PHP can do.
:) It's just a matter of breaking down each task into its smallest steps. Computers aren't very smart, so you have to spell it out for them. Where you would tell a person "Go down to the store and get a loaf of bread," you have to tell a computer, "Get up from the couch. Put your hand in your pocket. Get out your keys. Open the door. Walk to the car...." But they do it all really fast.  ;D The coolest thing about databases is that the information is all right there and you can do anything you want with it.

I think I got the image thing figured out.

Change
'stars' => empty($row['stars']) ? '' : $row['stars'],

to

'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),

and change

<center><img src="' . $settings['images_url'] . '/medium/' . $groups[$rank]['stars'] . '"></center></td>';

to

<center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';

Now, for the teams. I'm assuming that your team designation is stored in the "additionalGroups" field.

Just before

$groups = '';

add


$team[32] = '[SRB]';
$team[33] = '[STA]';
$team[34] = '[MFR]';


Change

    SELECT ID_GROUP, ID_MEMBER, realName, avatar, usertitle,
           emailAddress, hideEmail, lastLogin, location, personalText,
           totalTimeLoggedIn, dateRegistered, ICQ, AIM, YIM, MSN, cs_stats,
           css_stats, hideEmail, emailAddress


to

    SELECT ID_GROUP, ID_MEMBER, realName, avatar, usertitle,
           emailAddress, hideEmail, lastLogin, location, personalText,
           totalTimeLoggedIn, dateRegistered, ICQ, AIM, YIM, MSN, cs_stats,
           css_stats, hideEmail, emailAddress, additionalGroups


and change

        echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '">-RoTa- ' . $abbrev[$rank] . '|<b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b></font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . $row2['usertitle'] . '</td>';


to

        echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '">-RoTa- ' . $abbrev[$rank] . '|<b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b>';
if ($row2['additionalGroups'] > 0)
  echo ' '. $team[$row2['additionalGroups']] . ' ';
echo '</font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . $row2['usertitle'] . '</td>';


If you have trouble with the editing, just let me know and I'll post the whole thing again. Sometimes it's hard to locate things in that much code.

And I'm still working on how to get this down to just two calls to the database. :)
Title: Re: Roster Page
Post by: londonhogfan on August 24, 2006, 03:01:54 PM
ok looking good.  Here is the product.
http://www.the-rota.com/?page=64

There are a few people that the team don't show for because they have more than 1 secondary group. (I have way too many groups - Used for permissions)  anyway to get it to work if they are in the group at all?

Thanks again for all your help.
Title: Re: Roster Page
Post by: JPDeni on August 24, 2006, 03:27:32 PM
Quoteanyway to get it to work if they are in the group at all?
Yep.

Change
if ($row2['additionalGroups'] > 0)
  echo ' '. $team[$row2['additionalGroups']] . ' ';


to


if ($row2['additionalGroups'] <> '' )
{
  $addl = explode(',',$row2['additionalGroups']);
  foreach ($team as $key => $value)
  {
    if (in_array($key,$addl))
      echo ' '. $value . ' ';
  }
}


I think it's kind of appropriate that we use the "explode" function with all this military stuff. ;D

I'm so glad I finally figured out the image thing. That was bothering me a lot. All it took was actually looking at the source code to figure it out.

If this all works. I'll put together the whole code and rewrite it to make the fewer calls. I think I've got that worked out in my head.
Title: Re: Roster Page
Post by: londonhogfan on August 24, 2006, 03:45:36 PM
works :D

here is the final code you came up with...

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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces. (I notice that "Major" is missing.)
$rankorder = array(
  'General',
  'Brigadier General',
  'Colonel',
  'Lieutenant Colonel',
  'Captain',
  '1st Lieutenant',
  'Sergeant Major',
  'First Sergeant',
  'Master Sergeant',
  'Staff Sergeant',
  'Sergeant',
  'Corporal',
  'Lance Corporal',
  'Private First Class',
  'Private'
);
$abbrev = array(
'General' => 'Gen',
  'Brigadier General' => 'BGen',
  'Colonel' => 'Col',
  'Lieutenant Colonel' => 'LtCol',
  'Captain' => 'Cap',
  '1st Lieutenant' => '1stLt',
  'Sergeant Major' => 'SgtMaj',
  'First Sergeant' => '1stSgt',
  'Master Sergeant' => 'MSgt',
  'Staff Sergeant' => 'SSgt',
  'Sergeant' => 'Sgt',
  'Corporal' => 'Cpl',
  'Lance Corporal' => 'LCpl',
  'Private First Class' => 'PFC',
  'Private'  => 'Pvt'
);

$team[32] = '[SRB]';
$team[33] = '[STA]';
$team[34] = '[MFR]';
$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $query2 = db_query("
    SELECT ID_GROUP, ID_MEMBER, realName, avatar, usertitle,
           emailAddress, hideEmail, lastLogin, location, personalText,
           totalTimeLoggedIn, dateRegistered, ICQ, AIM, YIM, MSN, cs_stats,
           css_stats, hideEmail, emailAddress, additionalGroups
    FROM {$db_prefix}members
    WHERE ID_GROUP = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="25"></td>';
      echo '<td class="catinfo" width="245"><b>GAMING ALIAS</b></td>';
      echo '<td class="catinfo" width="130"><b>NAME</b></td>';
      echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="100"><b>PSYCHOSTATS</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
        echo '<td class="windowbg2 height="40"><img src="http://www.the-rota.com/Themes/default/images/flags/' . $row2['location'] . '.png" alt="' . $row2['location'] . '"></td>';
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '">-RoTa- ' . $abbrev[$rank] . '|<b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b>';
if ($row2['additionalGroups'] <> '' )
{
  $addl = explode(',',$row2['additionalGroups']);
  foreach ($team as $key => $value)
  {
    if (in_array($key,$addl))
      echo ' '. $value . ' ';
  }
}
echo '</font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . $row2['usertitle'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        if($row2['cs_stats'] != '')
          echo '<a href="' . $row2['cs_stats'] . '" target="_blank"><img src="' . $settings['images_url'] . '/cs_stats.gif" alt="CS 1.6 Stats" border="0" /></a> ';
        if($row2['css_stats'] != '')
          echo '<a href="' . $row2['css_stats'] . '" target="_blank"><img src="' . $settings['images_url'] . '/css_stats.gif" alt="CS:Source Stats" border="0" /></a> ';
        echo '</td><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> ';

//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><br>';
  }
}
Title: Re: Roster Page
Post by: londonhogfan on August 24, 2006, 03:59:07 PM
JPDeni please don't take this as me being greedy, but I would regret it if I didn't ask.

(If your tired of working on this I understand - I can't thank you enough for all your help)

Would it be possible to only show members in certain teams?

I have a team page for each team using Blocs meet the team script (which is "awesome") but it doesn't work very well for what I am using it for.

They are here...
http://www.the-rota.com/?page=48
http://www.the-rota.com/?page=49
http://www.the-rota.com/?page=50

the thing I don't like about them is they are not in rank order and they don't show their full tag.  Is it possible to use the same script you have made here but only show them if they are in a certain group?  I could then just change the group for each team.  That way I will have a clan roster and 3 team rosters that will all look alike.

Again, I can't thank you enough for your help.

-Jacob
Title: Re: Roster Page
Post by: JPDeni on August 24, 2006, 04:33:43 PM
(I looked at your pages. One of your members has an animated avatar that looks like a teenage mutant ninja turtle.  :2funny: It's nice to get that kind of a laugh this early in the morning. I may have to go look at that again.)

Heck, Jacob, you could probably do it all with one page!  ;D Hmmmmm. I think we should give it a try. This is really slick. If it works.

At the beginning of the code, right under the "global" line, add


if (isset($_GET['rteam']))
  $rteam = ' AND FIND_IN_SET('. $_GET['rteam'] . ',additionalGroups)';
else
  $rteam = '';


Change

    WHERE ID_GROUP = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);

to

    WHERE ID_GROUP = '" . $groups[$rank]['id'] . "'
             $rteam", __FILE__, __LINE__);


To get your whole roster, link to it in the regular way -- index.php?page=64

To get to your individual teams, put the team number in the URL -- index.php?page=64;rteam=32

Crossing fingers.
Title: Re: Roster Page
Post by: londonhogfan on August 24, 2006, 04:46:56 PM
I <3 YOU
Title: Re: Roster Page
Post by: JPDeni on August 24, 2006, 04:55:54 PM
 :2funny:

I take it that it worked.

:2funny:

Is that slick or what? The coolest thing was when I figured out I could do that with TP. Opened up a whole world of possibilities. I've created my own image gallery and articles database and links manager, all because of that little thing. (I know some of this is coming up in future versions of TP, but this way I could make it my own way.)

I have this "thing" about redundancy. I hate it. If I can make a script do double-duty, I'll get that whip out and force it into line.

I'm really glad it worked for you. You know, I get the same charge out of writing a script that works as I do when I win at gambling. And programming doesn't cost anything.  ;D
Title: Re: Roster Page
Post by: londonhogfan on August 24, 2006, 05:06:07 PM
yes, it worked great.

It gives me the ability to have more things..

for example we have a little tourney where you can win the "Jack Bauer Award" Its a 1v1 pistol match (Silencer on) and the winner gets the award.  So I have a group setup and each month we add a new winner... Now I can show all previous winners.

Same for recruits, and even a meet the team style page.

Thanks a bunch.
Title: Re: Roster Page
Post by: JPDeni on August 24, 2006, 05:16:35 PM
I see. Oh, that's wonderful. I ended up making it better than I even thought. ;D

This stuff is just great, isn't it?

I think I'm going to let it be now, though. I could tinker with it some more and maybe cut down on the database calls, but this is working nicely now and I don't want to risk messing it up. If there's anything else you want to add, we can see if we can, but I think I can finally sleep now without worrying about your huge php page.  :D
Title: Re: Roster Page
Post by: londonhogfan on August 24, 2006, 05:23:02 PM
yes, Its perfect just the way it is  :D
Title: Re: Roster Page
Post by: Assistance on August 24, 2006, 06:54:04 PM
I run a clan site aswell

allthough I didnt get this to work out (no error codes or nothing ) to look like yours
I have learned a few things from this thread.

Not to sure how long I have been trying ( reading/copy/paste/ ) to get this to work

edit.......lol 20 minutes (wow)

anyways,  I got the justs of it figured out

cant wait to see your final code
also works with the custom actions mod ^^ action=roster


I wonder how many clan webmasters would gladly give you a med pack for your work
Title: Re: Roster Page
Post by: JPDeni on August 24, 2006, 06:59:19 PM
What isn't working for you, Assistance? Can I give you some, uh, assistance? ;)

I think this is the final code. Well, the last one that londonhogfan posted, with my edits to make it work with all the different groups.

I'll have to take a look at that custom actions mod. I might be able to use it for some other things.
Title: Re: Roster Page
Post by: Assistance on August 24, 2006, 07:13:41 PM
oh if you need to sleep plz go ahead

I need to atleast clean up my code a bit
(set bg class, remove msn, yahoo, etc, add in the flag)

but I do know the avatars are not showing nor is flags, and i do have that mod installed

if your awake in rought 10-20 mins I'll have a better gathering of where I am


yes my name is ironic is it not?
oh and I'm sure you will get use of the custom action mod
specially if you like it to show action=name
instead of using articles ;)
Title: Re: Roster Page
Post by: JPDeni on August 24, 2006, 07:17:25 PM
I'm definitely awake. It's still in the morning here.

I don't think there are individual avatars in the code I've been working on. There's the "stars" for the group, but not individual avatars. You'd have to add them.

I'm working with the custom action thing now, trying to figure out how to use it.
Title: Re: Roster Page
Post by: londonhogfan on August 24, 2006, 07:21:02 PM
the flags thing in the previous code is something I put into my site custom (before the mod) I just replaced the location box with a dropdown box with the country names... then had the flags with the same name so just put img codes around the location name to produce flags.

Way too much work when a mod was made that did it easier and better just a couple days after I did mine.
Title: Re: Roster Page
Post by: Assistance on August 24, 2006, 07:47:17 PM
pardon my noobness

but I am guessing "for me" since the "flag mod"  installed it should be easier for me to put it in ( that is if I knew what i was doing :P ) seems like same as location mod?

ah no avatars, thats ok actually, they would kinda distort things a bit

what I have been tryin to do is insert my data overtop of latest working one provided
but seeing as that one is purley custom made it wont be plug and go for everyone else to use.

I think i might strip everything out, and start as if it was fresh, but then I will have php troubles trying to insert my new stuff for my members..... sigh

I feel like a noob starting a game for the first time
standing around pressing buttons, flipping thrw a manual between spawns :P

Title: Re: Roster Page
Post by: JPDeni on August 24, 2006, 07:52:38 PM
Basically, what you need to do is to find out the field names for what you want to display on the page and how you want to display it. An easy way to do it would be to make up a fake record, but instead of actual data, put in the field names. At that point, it's just a matter of doing some subsitution of variable names.
Title: Re: Roster Page
Post by: londonhogfan on August 24, 2006, 08:06:20 PM
try this.  I removed everything that was custom to my site (I think)

just change your Rank Member Groups whre you see...

  'rank 1',
  'rank 2',
  'rank 3',
  'rank 4',
  'rank 5',

add or remove as needed


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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  'rank 1',
  'rank 2',
  'rank 3',
  'rank 4',
  'rank 5',
);

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $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 = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="270"><b>GAMING ALIAS</b></td>';
      echo '<td class="catinfo" width="130"><b>NAME</b></td>';
      echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="100"><b>LOCATION</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b>';

echo '</font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . $row2['usertitle'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '<i>' . $row2['location'] . '</i>';
        echo '</td><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> ';

//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><br>';
  }
}
Title: Re: Roster Page
Post by: Assistance on August 24, 2006, 08:13:56 PM
css_stats

name ?
Title: Re: Roster Page
Post by: londonhogfan on August 24, 2006, 08:23:53 PM
edited the code... removed css_stats

the name column is just their custom title in the forum.  So you could remove Name and replace with "title" or just put their name in that field of their profile.
Title: Re: Roster Page
Post by: Assistance on August 24, 2006, 09:10:57 PM
ok

got it cleaned up and pretty much how I want it displayed

in place of NAME, I left that open for now so I can throw in my custom parts

should I ask here or should I ask in the thread the mod was made in?
the blank spot in the middle will be for the country flag mod
and the contact will be from the awards mod
Title: Re: Roster Page
Post by: JPDeni on August 24, 2006, 09:15:02 PM
Do you know the names of the fields that hold the flag and awards info?
Title: Re: Roster Page
Post by: Assistance on August 24, 2006, 09:37:45 PM
Awards
$message['member']['options']['profile_postawards']))
{
$postawards = parse_bbc($message['member']['options']['profile_postawards']);
echo '<br />Awards: ' . $postawards . '';

profile_postawards
or postawards


flag
// Did they select a flag?
if(isset($message['member']['options']['country']) && !empty($modSettings['country_flag_show']) && !empty($context['member']['options']['country']))
{
$flags = CountryFlag();
echo '
<img src="', $settings['default_theme_url'], '/images/flags/', $message['member']['options']['country'], '.png" alt="', $flags[$message['member']['options']['country']], '" /> ', $flags[$message['member']['options']['country']], '<br /><br />';
}


I thought it was country, but I tried b4 with replacing the before "location" in the 3 places with "country" but that didnt work.

I hope that is what you meant by field, I tossed up the code to show you where I got it from


Title: Re: Roster Page
Post by: Porky on September 08, 2006, 01:06:42 AM
Need some help How due I call in the Avatar in the block shown
http://devilsrejects.porkrindstudios.com/smf/index.php?page=11

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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(

  'General',
  'Lieutenant General',
  'Major General',
  'Brigadier General',
  'Colonel',
  'Major',
  'Captain',
  'First Lieutenant',
  'Second Lieutenant',
  'Command Sergeant Major of the Army',
  'Command Sergeant Major',
  'Sergeant Major',
  'Master Sergeant',
  'First Sergeant',
  'Sergeant First Class',
  'Staff Sergeant',
  'Sergeant',
  'Specialist',
  'Private First Class',
  'Private',
  'Recruit',
  'Chief Warrant Officer CW5',
  'Chief Warrant Officer (CW4)',
  'Chief Warrant Officer (CW3)',
  'Chief Warrant Officer (CW2)',
  'Warrant Officer (WO1)',

);

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $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 = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="270"><b>GAMING ALIAS</b></td>';
      echo '<td class="catinfo" width="130"><b>Avatar</b></td>';
      echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="100"><b>LOCATION</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b>';

echo '</font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . $row2['usertitle'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '<i>' . $row2['location'] . '</i>';
        echo '</td><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> ';

//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><br>';
  }
}
Title: Re: Roster Page
Post by: londonhogfan on September 08, 2006, 01:58:03 AM
like your theme.
Title: Re: Roster Page
Post by: Porky on September 08, 2006, 02:09:34 AM
it's pretty good except a couple of problems with it. If you go to high on the resolution it breaks up at the top and looks funky
Title: Re: Roster Page
Post by: samson on September 11, 2006, 02:31:46 AM
I had this working I upgraded to
v0.9.5
and now it looks like this
http://www.ligs.us/smf3/index.php?page=18

any ideas?

nm there was a space in the article all fixed
Title: Re: Roster Page
Post by: G6Cad on September 11, 2006, 10:04:42 AM
If you upgrade, you replace all the TP files with new ones, so i suggest you go back to the first post here and start reading on what code to add where in the new Tp files in order to get it back
Title: Re: Roster Page
Post by: kran1um on October 22, 2006, 12:45:41 AM
How do I add xfire into londonhogfan's code. WHere do I put it and I downloaded the xfire package and still doesnt show up.
Title: Re: Roster Page
Post by: ash on November 01, 2006, 06:06:36 PM
Damn, I thought this was a snippet on "Roasting" for the upcoming thanksgiving holiday!

I was looking forward to rasting my turkey in TP!
]

heh j/k, I had to do it!
;D

Title: Re: Roster Page
Post by: misfitmafia on December 22, 2006, 02:28:01 PM
Anyone know how to modify this to show a secondary member group instead of the primary. I tried just putting in the secondary group name in place of the primary but then it displays all registered members?
Title: Re: Roster Page
Post by: Adamzon on December 22, 2006, 11:00:37 PM
MisFitMafia: I need the same thing... :)

/adam
Title: Re: Roster Page
Post by: Assistance on December 25, 2006, 02:36:30 AM
try looking at ssi member group
Title: Re: Roster Page
Post by: Adamzon on December 27, 2006, 10:20:56 AM
Done that, but i cant figure it out....
Title: Re: Roster Page
Post by: Assistance on January 03, 2007, 11:40:30 AM
there was a code in this thread that did that

should be on one of the first few pages actually
Title: Re: Roster Page
Post by: Porky on January 03, 2007, 12:11:14 PM
Quoteglobal $txt, $scripturl, $user_info, $context, $modSettings, $ID_MEMBER, $board_info, $settings, $db_prefix;

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(41, 9, 39, 38,);
////////////////////////////////////////

$list_by_group = true;         // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups = true;   // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups = false;      // 'true' to include post-count based group in membership search
$include_moderators = false;      // 'true' to include board moderators on page
$repeats_allowed = false;      // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by = 'name';          // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type = 'none';         // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links['3'] = '5';
$extra_links['2'] = '11';

$extra_label_prefix = 'Page of ';   // text to precede member's name in link label for extra link
$extra_label_suffix = '';      // text to append to member's name in link label for extra link

$page_title = 'The Devils Rejects';
$page_subtitle = 'Some of the people you will meet around here!';

$moderator_group = 3;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord = 'mem.ID_MEMBER ASC';
if ($sort_by == 'posts') $sort_ord = 'mem.posts DESC';
if ($sort_by == 'name') $sort_ord = 'mem.realName ASC';

if (($extra_type != 'board') && ($extra_type != 'page')) $extra_type = 'none';

if ($include_moderators)
   {if (!in_array($moderator_group, $groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if ($list_by_group)
   {$groups_to_use = $groups_list;}
else
   {$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo '<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
   <td colspan="4"><h2>', $page_title, '</h2>
   <span class="smalltext">', $page_subtitle, '</span>
</td></tr>';

if (!$list_by_group)
   echo '<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
      <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2> </h2>
      </td></tr>';

foreach($groups_to_use as $groupnumber)
{
   $loaded_ids = array();
   $user_profile=array();
   $memberContext=array();
   $profile=array();
   $context['TPortal']['team']=array();

   // get the name of the group
   $request = db_query("
      SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
   if(mysql_num_rows($request)>0){
      $row = mysql_fetch_row($request);
      $groupNameX=$row[0];
      mysql_free_result($request);
   }

   if ($list_by_group) {
      $select_where = 'mem.ID_GROUP = '.$groupnumber;
      if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
      if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
      if ($include_moderators && ($groupnumber == $moderator_group)) $select_where = 'mem.ID_MEMBER = m.ID_MEMBER';
   }
   else {
      $select_where = 'mem.ID_GROUP IN (' . implode(', ', $groups_list) . ')';
      if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
      if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP IN (' . implode(', ', $groups_list) . ')';
      if ($include_moderators) $select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
   }

   $select_where = '(' . $select_where . ') AND mem.ID_MEMBER NOT IN (' . implode(', ', $users_already_listed) . ')';

   // Load the member's data.
   $request = db_query("
      SELECT   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 as memnum, mem.memberName, mem.ID_GROUP,
         mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
         mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName
      FROM ({$db_prefix}members AS mem)
         LEFT JOIN {$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
         LEFT JOIN {$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
         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)
      WHERE $select_where
      GROUP BY mem.ID_MEMBER
      ORDER BY $sort_ord", __FILE__, __LINE__);
   $new_loaded_ids = array();
   $member_count = 0;

   while ($row = mysql_fetch_assoc($request))
   {
      if (!$repeats_allowed) $users_already_listed[$row['memnum']] = $row['memnum'];

      $member_count += 1;

      $avatar_width = '';
      $avatar_height = '';
      if($context['browser']['is_ie6']) $avatar_width = 'width="' . $modSettings['avatar_max_width_external'] . '"';

      $context['TPortal']['team'][] = array(
         'username' => $row['memberName'],
         'usertitle' => $row['usertitle'],
         'name' => $row['realName'],
         'groupname' => ($groupnum == 0) ? $row['groupName'] : $groupNameX ,
         'posts' => $row['posts'],
         'karmabad' => $row['karmaBad'],
         'karmagood' => $row['karmaGood'],
         'location' => $row['location'],
         'href' => $scripturl . '?action=profile;u=' . $row['memnum'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['memnum'] . '" 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="" style="max-height:280px;max-width:180px;" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" style="max-height:280px;max-width:180px;" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" 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'],
         'member_page' => ($extra_type == 'none') ? '' : empty($extra_links[$row['memnum']]) ? '' : $extra_links[$row['memnum']],
      );

   }
   mysql_free_result($request);

   if ($member_count > 0)
   {
      if ($list_by_group)
      echo '<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
         <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2>' . $groupNameX . '</h2>
         </td></tr>';

      echo '<tr>';
           $newrow=0;

      foreach($context['TPortal']['team'] as $team)
           {
         echo '
            <td valign="top" width="18%">'.$team['avatar']['image'].'</td>';

         echo '   <td valign="top" class="middletext" style="padding: 2px;">';

            echo '<h2 style="margin-top: 0; margin-bottom: 4px;">'.$team['link'].'</h2>';

            echo ''. $team['usertitle'].'
';

            if (!$list_by_group)
               echo ''.$txt[87].': '.$team['groupname'].'
';

            if ($modSettings['karmaMode'] == '1')
               echo '', $modSettings['karmaLabel'], ' ', $team['karmagood'] - $team['karmabad'], '
';
            elseif ($modSettings['karmaMode'] == '2')
               echo '', $modSettings['karmaLabel'], ' +', $team['karmagood'], ' | -', $team['karmabad'], '
';

            echo ''.$txt['lastLoggedIn'].': '.$team['last_login'].'
';

            echo !empty($team['location']) ? ''.$txt[227].': '.$team['location'].'
' : '';

            echo !empty($team['website']['title']) ? ''.$txt[96].': <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a>
' : '';

            echo $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'
' : $team['online']['text'].'
';

            echo ''.$txt[86].': '.$team['posts'].'
';

            echo !empty($team['blurb']) ? '- '.$team['blurb'].'
' : '';

            echo !empty($team['teamtext']) ? $team['teamtext'].'
' : '';

            if (($extra_type == 'board') && !empty($team['member_page']))
               echo '<a href="' . $scripturl . '?board=' . $team['member_page'] . '">'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</a>
';
            if (($extra_type == 'page') && !empty($team['member_page']))
               echo '<a href="' . $scripturl . '?page=' . $team['member_page'] . '">'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</a>
';

         echo '
            </td>';

         $newrow++;
         if($newrow>1){
            $newrow=0;
            echo '</tr><tr><td colspan="4"></td></tr><tr>';
         }
           }
      if($newrow=1) echo '<td colspan="2"></td>';
      echo '</tr>';
   }

}
echo '</table>';

Edit Group List on line 5 to your group numbers
Title: Re: Roster Page
Post by: Adamzon on January 03, 2007, 12:33:28 PM
U are simply wonderful! THANX!!!!!!!!!!!!  O0 :2funny: :up: :up:
Title: Re: Roster Page
Post by: Adamzon on January 03, 2007, 12:40:58 PM
Ran into 2 problems.

1: Table width is a bit wide
2: I got [/url] tag on two places.

Im a bit stupid, but i promise to donate some money to u if u help me with this :)



Title: Re: Roster Page
Post by: G6Cad on January 03, 2007, 12:50:48 PM
Svensk ser jag :)

Can you give me a tempadmin account on your forum so i can look at the code in the article ?
Title: Re: Roster Page
Post by: Adamzon on January 03, 2007, 12:55:19 PM
tried to pm u
Title: Re: Roster Page
Post by: G6Cad on January 03, 2007, 12:59:05 PM
I got the account.
I will have a look right now.
Im not so familiar with the code from this snippet, but i will try and see why the [/url] are there. ansd reduce the width some
Title: Re: Roster Page
Post by: Adamzon on January 03, 2007, 12:59:35 PM
u are great!
Title: Re: Roster Page
Post by: G6Cad on January 03, 2007, 01:05:41 PM
The pass and username doesent seem to work. I have sended you a PM, i will register to your forum and you can just move me to the admin group and then when im done you can remove me from there again.
Title: Re: Roster Page
Post by: knat on January 03, 2007, 01:15:39 PM
I also have the [/url thing.. can you please post if you find the solution  ;)
Title: Re: Roster Page
Post by: G6Cad on January 03, 2007, 01:17:03 PM
Offcourse.
Other wise you guys can use my teampage code i think, as it do the exact same thing, but thats working great ;)
Title: Re: Roster Page
Post by: Adamzon on January 03, 2007, 01:38:33 PM
Se på fasen :D

Look att the fasen ;) haha..
U made it work!
Title: Re: Roster Page
Post by: G6Cad on January 03, 2007, 01:46:59 PM
I think i did, also the width i think is ok now, i changd it in the wrong spot, but when i saw the correct line and changed it, it WORKED!! Or alteast i hope
Title: Re: Roster Page
Post by: G6Cad on January 03, 2007, 01:50:27 PM
So exited I forgot to post the fix for the [/url]

Anyway, what i did was..

Find this part in the code for the rooster.
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['memnum'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . $row['realName'] . '[/url]',

Remove the

. '[/url]'

So it looks like this

$row['realName']'

Title: Re: Roster Page
Post by: jacortina on January 03, 2007, 03:56:30 PM
Almost, G6. Not quite.

The problem was that SOMEONE  :uglystupid2: was mixing HTML and BBCode (or that the code got copied outside of  '[ code ]' somewhere along the lines).

You don't want to just remove the '[/url]', you want to change it to '< /a >' (without the spaces). Note that if you try that ending HTML tag in a post edit box, it gets displayed as '[ /url ]' (without spaces).
Title: Re: Roster Page
Post by: Adamzon on January 03, 2007, 04:25:06 PM
Heres my Code.. And it works GREEEAAAT!
Thanx again to u all!


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

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(12, 11, 10,);
////////////////////////////////////////

$list_by_group = true;         // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups = true;   // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups = false;      // 'true' to include post-count based group in membership search
$include_moderators = false;      // 'true' to include board moderators on page
$repeats_allowed = false;      // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by = 'name';          // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type = 'none';         // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links['3'] = '5';
$extra_links['2'] = '11';

$extra_label_prefix = 'Page of ';   // text to precede member's name in link label for extra link
$extra_label_suffix = '';      // text to append to member's name in link label for extra link

$page_title = '';
$page_subtitle = 'Klubbar/Club!';

$moderator_group = 3;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord = 'mem.ID_MEMBER ASC';
if ($sort_by == 'posts') $sort_ord = 'mem.posts DESC';
if ($sort_by == 'name') $sort_ord = 'mem.realName ASC';

if (($extra_type != 'board') && ($extra_type != 'page')) $extra_type = 'none';

if ($include_moderators)
   {if (!in_array($moderator_group, $groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if ($list_by_group)
   {$groups_to_use = $groups_list;}
else
   {$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo '<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
   <td colspan="4"><h2>', $page_title, '</h2>
   <span class="smalltext">', $page_subtitle, '</span>
</td></tr>';

if (!$list_by_group)
   echo '<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
      <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2> </h2>
      </td></tr>';

foreach($groups_to_use as $groupnumber)
{
   $loaded_ids = array();
   $user_profile=array();
   $memberContext=array();
   $profile=array();
   $context['TPortal']['team']=array();

   // get the name of the group
   $request = db_query("
      SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
   if(mysql_num_rows($request)>0){
      $row = mysql_fetch_row($request);
      $groupNameX=$row[0];
      mysql_free_result($request);
   }

   if ($list_by_group) {
      $select_where = 'mem.ID_GROUP = '.$groupnumber;
      if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
      if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
      if ($include_moderators && ($groupnumber == $moderator_group)) $select_where = 'mem.ID_MEMBER = m.ID_MEMBER';
   }
   else {
      $select_where = 'mem.ID_GROUP IN (' . implode(', ', $groups_list) . ')';
      if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
      if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP IN (' . implode(', ', $groups_list) . ')';
      if ($include_moderators) $select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
   }

   $select_where = '(' . $select_where . ') AND mem.ID_MEMBER NOT IN (' . implode(', ', $users_already_listed) . ')';

   // Load the member's data.
   $request = db_query("
      SELECT   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 as memnum, mem.memberName, mem.ID_GROUP,
         mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
         mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName
      FROM ({$db_prefix}members AS mem)
         LEFT JOIN {$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
         LEFT JOIN {$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
         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)
      WHERE $select_where
      GROUP BY mem.ID_MEMBER
      ORDER BY $sort_ord", __FILE__, __LINE__);
   $new_loaded_ids = array();
   $member_count = 0;

   while ($row = mysql_fetch_assoc($request))
   {
      if (!$repeats_allowed) $users_already_listed[$row['memnum']] = $row['memnum'];

      $member_count += 1;

      $avatar_width = '';
      $avatar_height = '';
      if($context['browser']['is_ie6']) $avatar_width = 'width="' . $modSettings['avatar_max_width_external'] . '"';

      $context['TPortal']['team'][] = array(
         'username' => $row['memberName'],
         'usertitle' => $row['usertitle'],
         'name' => $row['realName'],
         'groupname' => ($groupnum == 0) ? $row['groupName'] : $groupNameX ,
         'posts' => $row['posts'],
         'karmabad' => $row['karmaBad'],
         'karmagood' => $row['karmaGood'],
         'location' => $row['location'],
         'href' => $scripturl . '?action=profile;u=' . $row['memnum'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['memnum'] . '" 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="" style="max-height:280px;max-width:180px;" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" style="max-height:280px;max-width:180px;" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" 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'],
         'member_page' => ($extra_type == 'none') ? '' : empty($extra_links[$row['memnum']]) ? '' : $extra_links[$row['memnum']],
      );

   }
   mysql_free_result($request);

   if ($member_count > 0)
   {
      if ($list_by_group)
      echo '<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
         <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2>' . $groupNameX . '</h2>
         </td></tr>';

      echo '<tr>';
           $newrow=0;

      foreach($context['TPortal']['team'] as $team)
           {
         echo '
            <td valign="top" width="18%">'.$team['avatar']['image'].'</td>';

         echo '   <td valign="top" class="middletext" style="padding: 2px;">';

            echo '<h2 style="margin-top: 0; margin-bottom: 4px;">'.$team['link'].'</h2>';

            echo ''. $team['usertitle'].'
';

            if (!$list_by_group)
               echo ''.$txt[87].': '.$team['groupname'].'
';

            if ($modSettings['karmaMode'] == '1')
               echo '', $modSettings['karmaLabel'], ' ', $team['karmagood'] - $team['karmabad'], '
';
            elseif ($modSettings['karmaMode'] == '2')
               echo '', $modSettings['karmaLabel'], ' +', $team['karmagood'], ' | -', $team['karmabad'], '
';

            echo ''.$txt['lastLoggedIn'].': '.$team['last_login'].'
';

            echo !empty($team['location']) ? ''.$txt[227].': '.$team['location'].'
' : '';

            echo !empty($team['website']['title']) ? ''.$txt[96].': <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a>
' : '';

            echo $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'
' : $team['online']['text'].'
';

            echo ''.$txt[86].': '.$team['posts'].'
';

            echo !empty($team['blurb']) ? '- '.$team['blurb'].'
' : '';

            echo !empty($team['teamtext']) ? $team['teamtext'].'
' : '';

            if (($extra_type == 'board') && !empty($team['member_page']))
               echo '<a href="' . $scripturl . '?board=' . $team['member_page'] . '">'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</a>
';
            if (($extra_type == 'page') && !empty($team['member_page']))
               echo '<a href="' . $scripturl . '?page=' . $team['member_page'] . '">'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</a>
';

         echo '
            </td>';

         $newrow++;
         if($newrow>1){
            $newrow=0;
            echo '</tr><tr><td colspan="4"></td></tr><tr>';
         }
           }
      if($newrow=1) echo '<td colspan="2"></td>';
      echo '</tr>';
   }

}
echo '</table>';
Title: Re: Roster Page
Post by: WarBirD on January 05, 2007, 01:02:34 AM
When I try this Code, i get this.

Quote
Parse error: parse error, unexpected '[' in /path/to/my/domain.com/subdomains/forums/httpdocs/Sources/Load.php(1733) : eval()'d code(9) : eval()'d code on line 236
Title: Re: Roster Page
Post by: jacortina on January 05, 2007, 01:17:33 AM
Well, if you used the code just above, look on line 236. You'll see it contans an extra "[ code ]" tag at the end.

Remove it.
Title: Re: Roster Page
Post by: IchBin on January 05, 2007, 02:03:07 AM
I fixed the code box, so just copy and paste/replace your code that you already have. :)
Title: Re: Roster Page
Post by: HappyFace on January 07, 2007, 05:01:35 PM
Loving it but how to make the font size a bit smaller? the profile text is way too big.

example: http://www.engineeringserver.com/forum/index.php?page=11

And if possible, list the profile like this:


Last Active: January 05, 2007, 09:38:15 PM
Location: Everywhere
Website: http://www.engineeringserver.com
Offline Posts: 2358 -
Technical Informatics Technology Student

instead of this: (current)

Last Active: January 05, 2007, 09:38:15 PM Location: Everywhere Website: http://www.engineeringserver.com Offline Posts: 2358 - Technical Informatics Technology Student
Title: Re: Roster Page
Post by: knat on January 07, 2007, 05:50:29 PM
I Would like it the same way as happyface pls  :)
Title: Re: Roster Page
Post by: JPDeni on January 07, 2007, 07:27:54 PM
Look at your code. It's quite clear where each thing is printed out. At the end of each thing, add


<br />


to add a linebreak

For example, the code says


            echo !empty($team['location']) ? ''.$txt[227].': '.$team['location'].'
' : '';


If you want to add a linebreak after the location is printed out, change it to


            echo !empty($team['location']) ? ''.$txt[227].': '.$team['location'].'<br />
' : '';
Title: Re: Roster Page
Post by: Ken. on January 07, 2007, 11:51:22 PM
How important is the 'space' and the '/' in a linebreak?
I've been using the linebreak without those two elements included and my code seems to be OK, although I do sometimes have to add two linebreaks back-to-back to get what I want for space.
Should I go back through and fix the ones that I can find?

Thanks... Ken

Code as I have it written in some (all?) of my articles, including this roster page.
<br>
Title: Re: Roster Page
Post by: jacortina on January 08, 2007, 12:11:55 AM
<br> works fine, but proper XHTML (not just HTML) is <br />

It just depends how concerned you are about meeting the XHTML standard.
Title: Re: Roster Page
Post by: Ken. on January 08, 2007, 12:44:16 AM
Quote from: J.A.Cortina on January 08, 2007, 12:11:55 AM
<br> works fine, but proper XHTML (not just HTML) is <br />

It just depends how concerned you are about meeting the XHTML standard.
Thanks J.A., something else to read up on! :o

Title: Re: Roster Page
Post by: RoarinRow on January 10, 2007, 12:32:45 AM
The code on the previous page displays, but I get these two errors in my log.  Any one know how I can fix?

8: Undefined index: 1
File: /forum/Themes/default/languages/Profile.english.php (eval?)
Line: 153

8: Undefined variable: groupnum
File: /forum/Themes/default/languages/Profile.english.php (eval?)
Line: 127

How should I define these variables?   :D
Title: Re: Roster Page
Post by: jacortina on January 10, 2007, 02:11:19 AM
It's hard to keep track of which iteration of the code is getting posted. This code was pulled into this thread from a thread about 'Meet the Team' (rather than 'Roster').

The $groupnum in that line should be $groupnumber. And there's an 'isset' test missing from the line that's giving the error on the '1'.

Here's the code I use (either copy in after the settings part on top or change them to what you need):
global $txt, $scripturl, $user_info, $context, $modSettings, $ID_MEMBER, $board_info, $settings, $db_prefix;

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(12, 11, 9, 10, 25, 28);
////////////////////////////////////////

$list_by_group = true; // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups = true; // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups = false; // 'true' to include post-count based group in membership search
$include_moderators = false; // 'true' to include board moderators on page
$repeats_allowed = false; // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by = 'name'; // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type = 'none'; // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links[3] = '5';
$extra_links[2] = '11';

$extra_label_prefix = 'Page of '; // text to precede member's name in link label for extra link
$extra_label_suffix = ''; // text to append to member's name in link label for extra link

$page_title = 'The D+X Team';
$page_subtitle = 'The people who guide the girls on their appointed paths';

$moderator_group = 3;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord = 'mem.ID_MEMBER ASC';
if ($sort_by == 'posts') $sort_ord = 'mem.posts DESC';
if ($sort_by == 'name') $sort_ord = 'mem.realName ASC';

if (($extra_type != 'board') && ($extra_type != 'page')) $extra_type = 'none';

if ($include_moderators)
{if (!in_array($moderator_group, $groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if ($list_by_group)
{$groups_to_use = $groups_list;}
else
{$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo '<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
<td colspan="4"><h2>', $page_title, '</h2>
<span class="smalltext">', $page_subtitle, '</span><br /></td></tr>';

if (!$list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" style="margin-top: 4px;">
<td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2> </h2>
</td></tr>';

foreach($groups_to_use as $groupnumber)
{
$loaded_ids = array();
$user_profile=array();
$memberContext=array();
$profile=array();
$context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupNameX=$row[0];
mysql_free_result($request);
}

if ($list_by_group) {
$select_where = 'mem.ID_GROUP = '.$groupnumber;
if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
if ($include_moderators && ($groupnumber == $moderator_group)) $select_where = 'mem.ID_MEMBER = m.ID_MEMBER';
}
else {
$select_where = 'mem.ID_GROUP IN (' . implode(', ', $groups_list) . ')';
if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP IN (' . implode(', ', $groups_list) . ')';
if ($include_moderators) $select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
}

$select_where = '(' . $select_where . ') AND mem.ID_MEMBER NOT IN (' . implode(', ', $users_already_listed) . ')';

// Load the member's data.
$request = db_query("
SELECT 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 as memnum, mem.memberName, mem.ID_GROUP,
mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName
FROM ({$db_prefix}members AS mem)
LEFT JOIN {$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
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)
WHERE $select_where
GROUP BY mem.ID_MEMBER
ORDER BY $sort_ord", __FILE__, __LINE__);
$new_loaded_ids = array();
$member_count = 0;

while ($row = mysql_fetch_assoc($request))
{
if (!$repeats_allowed) $users_already_listed[$row['memnum']] = $row['memnum'];

$member_count += 1;

$avatar_width = '';
$avatar_height = '';
if($context['browser']['is_ie6']) $avatar_width = 'width="' . $modSettings['avatar_max_width_external'] . '"';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'usertitle' => $row['usertitle'],
'name' => $row['realName'],
'groupname' => ($groupnumber == 0) ? $row['groupName'] : $groupNameX ,
'posts' => $row['posts'],
'karmabad' => $row['karmaBad'],
'karmagood' => $row['karmaGood'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['memnum'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['memnum'] . '" 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="" style="max-height:280px;max-width:180px;" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" style="max-height:280px;max-width:180px;" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" 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'],
'member_page' => ($extra_type == 'none') ? '' : (!isset($extra_links[intval($row['memnum'])]) ? '' : $extra_links[$row['memnum']]),
);

}
mysql_free_result($request);

if ($member_count > 0)
{
if ($list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" style="margin-top: 4px;">
<td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2>' . $groupNameX . '</h2>
</td></tr>';

echo '<tr>';
        $newrow=0;

foreach($context['TPortal']['team'] as $team)
        {
echo '
<td valign="top" width="18%">'.$team['avatar']['image'].'</td>';

echo ' <td valign="top" class="middletext" style="padding: 2px;">';

echo '<h2 style="margin-top: 0; margin-bottom: 4px;"><b>'.$team['link'].'</b></h2>';

echo '<b>'. $team['usertitle'].'</b><br />';

if (!$list_by_group)
echo '<b>'.$txt[87].'</b>: '.$team['groupname'].'<br />';

if ($modSettings['karmaMode'] == '1')
echo '<b>', $modSettings['karmaLabel'], '</b> ', $team['karmagood'] - $team['karmabad'], '<br />';
elseif ($modSettings['karmaMode'] == '2')
echo '<b>', $modSettings['karmaLabel'], '</b> +', $team['karmagood'], ' | -', $team['karmabad'], '<br />';

echo '<b>'.$txt['lastLoggedIn'].'</b>: '.$team['last_login'].'<br />';

echo !empty($team['location']) ? '<b>'.$txt[227].'</b>: '.$team['location'].'<br />' : '';

echo !empty($team['website']['title']) ? '<b>'.$txt[96].'</b>: <a href="'.$team['website']['url'].'" target="_blank"><u>'.$team['website']['title'].'</u></a><br />' : '';

echo $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />';

// echo '<b>'.$txt[86].'</b>: '.$team['posts'].'<br />';

echo !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '';

echo !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '';

if (($extra_type == 'board') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?board=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';
if (($extra_type == 'page') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?page=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';

echo '
</td>';

$newrow++;
if($newrow>1){
$newrow=0;
echo '</tr><tr><td colspan="4"></td></tr><tr>';
}
        }
if($newrow=1) echo '<td colspan="2"></td>';
echo '</tr>';
}

}
echo '</table>';
Title: Re: Roster Page
Post by: raxavier69 on January 18, 2007, 06:35:12 AM
I was wondering how do i add the users avatar in one of these td's and if possible the number of there awards with a link to there awards? i dont knwo anything about coding so can some one please help

im using this edited code:

Quoteglobal $db_prefix, $scripturl, $txt, $settings, $options;


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
   'Council Elder',
  'Council Member',
  'Dragoon',
  'Xuardian',
  'DraX',
  'Hatchling',
);

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $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 = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana">' . $rank . '</font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '">


<img src="/images/custom/r2/' . $rank . '.png">
</center></td>';
      echo '<td class="catinfo" width="130">User Name</td>';

      echo '<td class="catinfo" width="170">Last Online</td>';
      echo '<td class="catinfo" width="100">Location</td>';
      echo '<td class="catinfo" width="175">Contact</td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><font color="' . $groups[$rank]['color'] . '"">' . $row2['realName'] . '';

        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '' . $row2['location'] . '';
        echo '</td><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> ';

//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>
';
  }
}
Title: Re: Roster Page
Post by: hugo on March 08, 2007, 01:50:14 AM
Quote from: J.A.Cortina on January 10, 2007, 02:11:19 AM
It's hard to keep track of which iteration of the code is getting posted. This code was pulled into this thread from a thread about 'Meet the Team' (rather than 'Roster').

The $groupnum in that line should be $groupnumber. And there's an 'isset' test missing from the line that's giving the error on the '1'.

Here's the code I use (either copy in after the settings part on top or change them to what you need):
global $txt, $scripturl, $user_info, $context, $modSettings, $ID_MEMBER, $board_info, $settings, $db_prefix;

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(12, 11, 9, 10, 25, 28);
////////////////////////////////////////

$list_by_group = true; // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups = true; // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups = false; // 'true' to include post-count based group in membership search
$include_moderators = false; // 'true' to include board moderators on page
$repeats_allowed = false; // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by = 'name'; // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type = 'none'; // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links[3] = '5';
$extra_links[2] = '11';

$extra_label_prefix = 'Page of '; // text to precede member's name in link label for extra link
$extra_label_suffix = ''; // text to append to member's name in link label for extra link

$page_title = 'The D+X Team';
$page_subtitle = 'The people who guide the girls on their appointed paths';

$moderator_group = 3;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord = 'mem.ID_MEMBER ASC';
if ($sort_by == 'posts') $sort_ord = 'mem.posts DESC';
if ($sort_by == 'name') $sort_ord = 'mem.realName ASC';

if (($extra_type != 'board') && ($extra_type != 'page')) $extra_type = 'none';

if ($include_moderators)
{if (!in_array($moderator_group, $groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if ($list_by_group)
{$groups_to_use = $groups_list;}
else
{$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo '<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
<td colspan="4"><h2>', $page_title, '</h2>
<span class="smalltext">', $page_subtitle, '</span><br /></td></tr>';

if (!$list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" style="margin-top: 4px;">
<td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2> </h2>
</td></tr>';

foreach($groups_to_use as $groupnumber)
{
$loaded_ids = array();
$user_profile=array();
$memberContext=array();
$profile=array();
$context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupNameX=$row[0];
mysql_free_result($request);
}

if ($list_by_group) {
$select_where = 'mem.ID_GROUP = '.$groupnumber;
if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
if ($include_moderators && ($groupnumber == $moderator_group)) $select_where = 'mem.ID_MEMBER = m.ID_MEMBER';
}
else {
$select_where = 'mem.ID_GROUP IN (' . implode(', ', $groups_list) . ')';
if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP IN (' . implode(', ', $groups_list) . ')';
if ($include_moderators) $select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
}

$select_where = '(' . $select_where . ') AND mem.ID_MEMBER NOT IN (' . implode(', ', $users_already_listed) . ')';

// Load the member's data.
$request = db_query("
SELECT 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 as memnum, mem.memberName, mem.ID_GROUP,
mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName
FROM ({$db_prefix}members AS mem)
LEFT JOIN {$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
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)
WHERE $select_where
GROUP BY mem.ID_MEMBER
ORDER BY $sort_ord", __FILE__, __LINE__);
$new_loaded_ids = array();
$member_count = 0;

while ($row = mysql_fetch_assoc($request))
{
if (!$repeats_allowed) $users_already_listed[$row['memnum']] = $row['memnum'];

$member_count += 1;

$avatar_width = '';
$avatar_height = '';
if($context['browser']['is_ie6']) $avatar_width = 'width="' . $modSettings['avatar_max_width_external'] . '"';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'usertitle' => $row['usertitle'],
'name' => $row['realName'],
'groupname' => ($groupnumber == 0) ? $row['groupName'] : $groupNameX ,
'posts' => $row['posts'],
'karmabad' => $row['karmaBad'],
'karmagood' => $row['karmaGood'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['memnum'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['memnum'] . '" 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="" style="max-height:280px;max-width:180px;" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" style="max-height:280px;max-width:180px;" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" 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'],
'member_page' => ($extra_type == 'none') ? '' : (!isset($extra_links[intval($row['memnum'])]) ? '' : $extra_links[$row['memnum']]),
);

}
mysql_free_result($request);

if ($member_count > 0)
{
if ($list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" style="margin-top: 4px;">
<td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2>' . $groupNameX . '</h2>
</td></tr>';

echo '<tr>';
        $newrow=0;

foreach($context['TPortal']['team'] as $team)
        {
echo '
<td valign="top" width="18%">'.$team['avatar']['image'].'</td>';

echo ' <td valign="top" class="middletext" style="padding: 2px;">';

echo '<h2 style="margin-top: 0; margin-bottom: 4px;"><b>'.$team['link'].'</b></h2>';

echo '<b>'. $team['usertitle'].'</b><br />';

if (!$list_by_group)
echo '<b>'.$txt[87].'</b>: '.$team['groupname'].'<br />';

if ($modSettings['karmaMode'] == '1')
echo '<b>', $modSettings['karmaLabel'], '</b> ', $team['karmagood'] - $team['karmabad'], '<br />';
elseif ($modSettings['karmaMode'] == '2')
echo '<b>', $modSettings['karmaLabel'], '</b> +', $team['karmagood'], ' | -', $team['karmabad'], '<br />';

echo '<b>'.$txt['lastLoggedIn'].'</b>: '.$team['last_login'].'<br />';

echo !empty($team['location']) ? '<b>'.$txt[227].'</b>: '.$team['location'].'<br />' : '';

echo !empty($team['website']['title']) ? '<b>'.$txt[96].'</b>: <a href="'.$team['website']['url'].'" target="_blank"><u>'.$team['website']['title'].'</u></a><br />' : '';

echo $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />';

// echo '<b>'.$txt[86].'</b>: '.$team['posts'].'<br />';

echo !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '';

echo !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '';

if (($extra_type == 'board') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?board=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';
if (($extra_type == 'page') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?page=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';

echo '
</td>';

$newrow++;
if($newrow>1){
$newrow=0;
echo '</tr><tr><td colspan="4"></td></tr><tr>';
}
        }
if($newrow=1) echo '<td colspan="2"></td>';
echo '</tr>';
}

}
echo '</table>';


Very nice, im trying to use this to make a guild roster where will be alot members, was hoping if anyone could make a "tiny roster page" version,  with only the username and fixed size avatars, like username and bottom of it avatar, 4 users per one line, and to count both primary and secondary groups, i think someome who know php would just delete 60% of the code and get it, but im all lost in PHP :| please someone help me out *smile nicely on you* :))
Title: Re: Roster Page
Post by: hugo on March 19, 2007, 12:14:25 AM
someone save my soul :O
Title: Re: Roster Page
Post by: DOOM666 on April 05, 2007, 05:35:29 AM
this is the code im useing right know because i like the look and the layout, and i can change the images on the left  

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 = 'Major 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> ' . $data['name'] . '</b></font></td></tr><tr><td rowspan="70" width="75" class="windowbg" valign="top"><br><center><img src="http://www.dfaclan.nationvoice.com/dfa_forums/Themes/helios_multi11final_tp/images/rank_19.png "></center></td>';
echo '';
echo '<td class="catbg2" width="280">Socom Name</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'] . '"><b><font color="' . $data['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b></font></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>';


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 = 'Brigadier 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> ' . $data['name'] . '</b></font></td></tr><tr><td rowspan="70" width="75" class="windowbg" valign="top"><br><center><img src="http://www.dfaclan.nationvoice.com/dfa_forums/Themes/helios_multi11final_tp/images/rank_18.png "></center></td>';
echo '';
echo '<td class="catbg2" width="280">Socom Name</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'] . '"><b><font color="' . $data['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b></font></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>';

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 = 'Captain'
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> ' . $data['name'] . '</b></font></td></tr><tr><td rowspan="70" width="75" class="windowbg" valign="top"><br><center><img src="http://www.dfaclan.nationvoice.com/dfa_forums/Themes/helios_multi11final_tp/images/rank_14.png "></center></td>';
echo '';
echo '<td class="catbg2" width="280">Socom Name</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'] . '"><b><font color="' . $data['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b></font></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>';


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 = '1st Lieutenant'
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> ' . $data['name'] . '</b></font></td></tr><tr><td rowspan="70" width="75" class="windowbg" valign="top"><br><center><img src="http://www.dfaclan.nationvoice.com/dfa_forums/Themes/helios_multi11final_tp/images/rank_13.png "></center></td>';
echo '';
echo '<td class="catbg2" width="280">Socom Name</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'] . '"><b><font color="' . $data['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b></font></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>';


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 = '2nd Lieutenant'
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> ' . $data['name'] . '</b></font></td></tr><tr><td rowspan="70" width="75" class="windowbg" valign="top"><br><center><img src="http://www.dfaclan.nationvoice.com/dfa_forums/Themes/helios_multi11final_tp/images/rank_12.png "></center></td>';
echo '';
echo '<td class="catbg2" width="280">Socom Name</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'] . '"><b><font color="' . $data['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b></font></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>';

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 = 'Private First Class'
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> ' . $data['name'] . '</b></font></td></tr><tr><td rowspan="70" width="75" class="windowbg" valign="top"><br><center><img src="http://www.dfaclan.nationvoice.com/dfa_forums/Themes/helios_multi11final_tp/images/rank_1.png "></center></td>';
echo '';
echo '<td class="catbg2" width="280">Socom Name</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'] . '"><b><font color="' . $data['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b></font></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>';

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 = 'Private'
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> ' . $data['name'] . '</b></font></td></tr><tr><td rowspan="70" width="75" class="windowbg" valign="top"><br><center><img src="http://www.dfaclan.nationvoice.com/dfa_forums/Themes/helios_multi11final_tp/images/rank_0.png "></center></td>';
echo '';
echo '<td class="catbg2" width="280">Socom Name</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'] . '"><b><font color="' . $data['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b></font></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>';


but i would like to use part of this code because it picks up the secondery groups not the primary groups how would i put the two together and make it work the way it is know

link to code i would like to use part of:
http://www.tinyportal.net/index.php?topic=8555.msg79951 (http://www.tinyportal.net/index.php?topic=8555.msg79951) reply33

here is a link to my site what im using
http://www.dfaclan.nationvoice.com/dfa_forums/index.php?page=8 (http://www.dfaclan.nationvoice.com/dfa_forums/index.php?page=8)
Title: Re: Roster Page
Post by: jacortina on April 24, 2007, 02:21:21 PM
Quote from: DOOM666 on April 05, 2007, 05:35:29 AM
but i would like to use part of this code because it picks up the secondery groups not the primary groups how would i put the two together and make it work the way it is know

Try changing:
$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__);


To:
$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'] . " OR FIND_IN_SET(".$data['id'].", additionalGroups) ", __FILE__, __LINE__);
Title: Re: Roster Page
Post by: DOOM666 on April 24, 2007, 04:16:17 PM
no that didn't pick up the secondary groups

I take that back its picking up one group not the others
Title: Re: Roster Page
Post by: jacortina on April 24, 2007, 04:31:56 PM
Did you change that line every place it exists?

The code you're implementing there uses mulitple repititions of the same basic chunk of code over and over and over again. Anything you ever change in it will require changing every occurrence.
Title: Re: Roster Page
Post by: DOOM666 on April 24, 2007, 04:33:16 PM
no i didn't i forgot that part. my bad
Title: Re: Roster Page
Post by: Earache on April 27, 2007, 01:10:46 AM
is tehre a way to change the font size of this snippet?  I find it way to big and want to shrink it.
Title: Re: Roster Page
Post by: jacortina on April 27, 2007, 01:27:32 AM
There are a couple of places where there is a specific font size given. Look for <font clauses with size= paramaters.

Other text is controlled stylesheet classes.
Title: Re: Roster Page
Post by: Earache on April 27, 2007, 02:10:13 AM
there is no <font clauses or size parameters, the only things i see are for avatars and its all in px format.
Title: Re: Roster Page
Post by: jacortina on April 27, 2007, 02:12:55 AM
Well, there's a number of different code sets in this thread and the most recent referred to had those.

Please post the code you're using (and be sure to use the 'code' tags, not 'quotes').
Title: Re: Roster Page
Post by: Earache on April 27, 2007, 03:47:07 AM
global $txt, $scripturl, $user_info, $context, $modSettings, $ID_MEMBER, $board_info, $settings, $db_prefix;

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(13,11);
////////////////////////////////////////

$list_by_group = true; // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups = true; // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups = false; // 'true' to include post-count based group in membership search
$include_moderators = false; // 'true' to include board moderators on page
$repeats_allowed = false; // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by = 'name'; // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type = 'none'; // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links[3] = '5';
$extra_links[2] = '11';

$extra_label_prefix = 'Page of '; // text to precede member's name in link label for extra link
$extra_label_suffix = ''; // text to append to member's name in link label for extra link

$page_title = 'MineMine Clan';
$page_subtitle = 'All me and all mine!';

$moderator_group = 3;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord = 'mem.ID_MEMBER ASC';
if ($sort_by == 'posts') $sort_ord = 'mem.posts DESC';
if ($sort_by == 'name') $sort_ord = 'mem.realName ASC';

if (($extra_type != 'board') && ($extra_type != 'page')) $extra_type = 'none';

if ($include_moderators)
{if (!in_array($moderator_group, $groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if ($list_by_group)
{$groups_to_use = $groups_list;}
else
{$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo '<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
<td colspan="4"><h2>', $page_title, '</h2>
<span class="smalltext">', $page_subtitle, '</span><br /></td></tr>';

if (!$list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" style="margin-top: 4px;">
<td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2> </h2>
</td></tr>';

foreach($groups_to_use as $groupnumber)
{
$loaded_ids = array();
$user_profile=array();
$memberContext=array();
$profile=array();
$context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupNameX=$row[0];
mysql_free_result($request);
}

if ($list_by_group) {
$select_where = 'mem.ID_GROUP = '.$groupnumber;
if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
if ($include_moderators && ($groupnumber == $moderator_group)) $select_where = 'mem.ID_MEMBER = m.ID_MEMBER';
}
else {
$select_where = 'mem.ID_GROUP IN (' . implode(', ', $groups_list) . ')';
if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP IN (' . implode(', ', $groups_list) . ')';
if ($include_moderators) $select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
}

$select_where = '(' . $select_where . ') AND mem.ID_MEMBER NOT IN (' . implode(', ', $users_already_listed) . ')';

// Load the member's data.
$request = db_query("
SELECT 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 as memnum, mem.memberName, mem.ID_GROUP,
mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName
FROM ({$db_prefix}members AS mem)
LEFT JOIN {$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
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)
WHERE $select_where
GROUP BY mem.ID_MEMBER
ORDER BY $sort_ord", __FILE__, __LINE__);
$new_loaded_ids = array();
$member_count = 0;

while ($row = mysql_fetch_assoc($request))
{
if (!$repeats_allowed) $users_already_listed[$row['memnum']] = $row['memnum'];

$member_count += 1;

$avatar_width = '';
$avatar_height = '';
if($context['browser']['is_ie6']) $avatar_width = 'width="' . $modSettings['avatar_max_width_external'] . '"';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'usertitle' => $row['usertitle'],
'name' => $row['realName'],
'groupname' => ($groupnumber == 0) ? $row['groupName'] : $groupNameX ,
'posts' => $row['posts'],
'karmabad' => $row['karmaBad'],
'karmagood' => $row['karmaGood'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['memnum'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['memnum'] . '" 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="" style="max-height:280px;max-width:180px;" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" style="max-height:280px;max-width:180px;" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" 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'],
'member_page' => ($extra_type == 'none') ? '' : (!isset($extra_links[intval($row['memnum'])]) ? '' : $extra_links[$row['memnum']]),
);

}
mysql_free_result($request);

if ($member_count > 0)
{
if ($list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" style="margin-top: 4px;">
<td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2>' . $groupNameX . '</h2>
</td></tr>';

echo '<tr>';
        $newrow=0;

foreach($context['TPortal']['team'] as $team)
        {
echo '
<td valign="top" width="18%">'.$team['avatar']['image'].'</td>';

echo ' <td valign="top" class="middletext" style="padding: 2px;">';

echo '<h2 style="margin-top: 0; margin-bottom: 4px;"><b>'.$team['link'].'</b></h2>';

echo '<b>'. $team['usertitle'].'</b><br />';

if (!$list_by_group)
echo '<b>'.$txt[87].'</b>: '.$team['groupname'].'<br />';

if ($modSettings['karmaMode'] == '1')
echo '<b>', $modSettings['karmaLabel'], '</b> ', $team['karmagood'] - $team['karmabad'], '<br />';
elseif ($modSettings['karmaMode'] == '2')
echo '<b>', $modSettings['karmaLabel'], '</b> +', $team['karmagood'], ' | -', $team['karmabad'], '<br />';

echo '<b>'.$txt['lastLoggedIn'].'</b>: '.$team['last_login'].'<br />';

echo !empty($team['location']) ? '<b>'.$txt[227].'</b>: '.$team['location'].'<br />' : '';

echo !empty($team['website']['title']) ? '<b>'.$txt[96].'</b>: <a href="'.$team['website']['url'].'" target="_blank"><u>'.$team['website']['title'].'</u></a><br />' : '';

echo $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />';

// echo '<b>'.$txt[86].'</b>: '.$team['posts'].'<br />';

echo !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '';

echo !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '';

if (($extra_type == 'board') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?board=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';
if (($extra_type == 'page') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?page=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';

echo '
</td>';

$newrow++;
if($newrow>1){
$newrow=0;
echo '</tr><tr><td colspan="4"></td></tr><tr>';
}
        }
if($newrow=1) echo '<td colspan="2"></td>';
echo '</tr>';
}

}
echo '</table>';


I'm using this one and can only find px syntax but all that I see that it pertains to is to '[custom_avatar_url]'
Title: Re: Roster Page
Post by: jacortina on April 27, 2007, 03:58:45 AM
OK < h2 > < /h2 > is used for page title, group name, user name. If you get rid of that in the places you want 'normal' sized, thay'll use the default text size.
Title: Re: Roster Page
Post by: RJL61 on May 27, 2007, 01:29:15 AM
I'm using the following code:

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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  'Administrator',
  'Clan Admin',
  'Clan Member',
);

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $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 = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="270"><b>ALIAS</b></td>';
      echo '<td class="catinfo" width="130"><b>CUSTOM TITLE</b></td>';
      echo '<td class="catinfo" width="175"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="100"><b>LOCATION</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b>';

echo '</font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg">' . $row2['usertitle'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg" align="center">';
        echo '<i>' . $row2['location'] . '</i>';
        echo '</td><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> ';

//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><br>';
  }
}


It looks OK in Firefox, but in IE the tables below Administrator look bloated. How can I fix that?
Thanks
Title: Re: Roster Page
Post by: tick on May 27, 2007, 02:41:37 AM
RJL61 please place code within the code brackets when posting code. thanks :)
Title: Re: Roster Page
Post by: IchBin on May 27, 2007, 02:59:33 AM
I can only suggest you try adjusting the cellspacing cellpadding etc. Even add some CSS styling padding and margin to see if it does what you want.
Title: Re: Roster Page
Post by: Velocity on June 02, 2007, 02:21:31 AM
I'm using this code:

<?php
function template_main()
{
global $txt$scripturl$user_info$context$modSettings$ID_MEMBER$board_info$settings$db_prefix;

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(12);
////////////////////////////////////////

$list_by_group true; // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups true; // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups false; // 'true' to include post-count based group in membership search
$include_moderators false; // 'true' to include board moderators on page
$repeats_allowed false; // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by 'name' // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type 'none'; // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links[3] = '5';
$extra_links[2] = '11';

$extra_label_prefix 'Page of '; // text to precede member's name in link label for extra link
$extra_label_suffix ''; // text to append to member's name in link label for extra link

$moderator_group 2;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord 'mem.ID_MEMBER ASC';
if (
$sort_by == 'posts'$sort_ord 'mem.posts DESC';
if (
$sort_by == 'name'$sort_ord 'mem.realName ASC';

if ((
$extra_type != 'board') && ($extra_type != 'page')) $extra_type 'none';

if (
$include_moderators)
{if (!in_array($moderator_group$groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if (
$list_by_group)
{$groups_to_use $groups_list;}
else
{$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo 
'<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td width="100%" align="left" valign="top" style="padding-top: 10px; padding-bottom: 10px;"><div class="tborder" ><table border="0" cellspacing="0" cellpadding="2" width="100%">
<td class="windowbg"><table align="center" width="96%" cellpadding="3" cellspacing="2">'
;

if (!
$list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" style="margin-top: 4px;">
<td class="catbg" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; ">
</td></tr>'
;

foreach(
$groups_to_use as $groupnumber)
{
$loaded_ids = array();
$user_profile=array();
$memberContext=array();
$profile=array();
$context['TPortal']['team']=array();

// get the name of the group
$request db_query("
SELECT groupName FROM 
{$db_prefix}membergroups WHERE ID_GROUP=$groupnumber"__FILE____LINE__);
if(mysql_num_rows($request)>0){
$row mysql_fetch_row($request);
$groupNameX=$row[0];
mysql_free_result($request);
}

if ($list_by_group) {
$select_where 'mem.ID_GROUP = '.$groupnumber;
if ($include_nonprimary_groups$select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
if ($include_post_groups$select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
if ($include_moderators && ($groupnumber == $moderator_group)) $select_where 'mem.ID_MEMBER = m.ID_MEMBER';
}
else {
$select_where 'mem.ID_GROUP IN (' implode(', '$groups_list) . ')';
if ($include_nonprimary_groups$select_where .= ' OR FIND_IN_SET(' implode(', mem.additionalGroups) OR FIND_IN_SET('$groups_list) . ', mem.additionalGroups)';
if ($include_post_groups$select_where .= ' OR mem.ID_POST_GROUP IN (' implode(', '$groups_list) . ')';
if ($include_moderators$select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
}

$select_where '(' $select_where ') AND mem.ID_MEMBER NOT IN (' implode(', '$users_already_listed) . ')';

// Load the member's data.
$request db_query("
SELECT 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 as memnum, mem.memberName, mem.ID_GROUP,
mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle, 
mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName
FROM (
{$db_prefix}members AS mem)
LEFT JOIN 
{$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN 
{$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
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)
WHERE 
$select_where
GROUP BY mem.ID_MEMBER
ORDER BY 
$sort_ord"__FILE____LINE__);
$new_loaded_ids = array();
$member_count 0;


while ($row mysql_fetch_assoc($request))
{
if (!$repeats_allowed$users_already_listed[$row['memnum']] = $row['memnum'];

$member_count += 1;

$avatar_width '';
$avatar_height '';
if($context['browser']['is_ie6']) $avatar_width 'width="' $modSettings['avatar_max_width_external'] . '"';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'usertitle' => $row['usertitle'],
'name' => $row['realName'],
'groupname' => ($groupnumber == 0) ? $row['groupName'] : $groupNameX ,
'posts' => $row['posts'],
'karmabad' => $row['karmaBad'],
'karmagood' => $row['karmaGood'],
'location' => $row['location'],
'href' => $scripturl '?action=profile;u=' $row['memnum'],
'link' => '<a href="' $scripturl '?action=profile;u=' $row['memnum'] . '" title="' $txt[92] . ' ' $row['realName'] . '">' $row['realName'] . '</a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > '<img  src="' . (empty($row['attachmentType']) ? $scripturl '?action=dlattach;attach=' $row['ID_ATTACH'] . ';type=avatar' $modSettings['custom_avatar_url'] . '/' $row['filename']) . '" alt="" style="max-height:280px;max-width:180px;" border="0" />' '') : (stristr($row['avatar'], 'http://') ? '<img src="' $row['avatar'] . '"' $avatar_width $avatar_height ' alt="" style="max-height:280px;max-width:180px;" border="0" />' '<img src="' $modSettings['avatar_url'] . '/' htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > ? (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']) ? 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'],
'member_page' => ($extra_type == 'none') ? '' : (!isset($extra_links[intval($row['memnum'])]) ? '' $extra_links[$row['memnum']]),
);

}
mysql_free_result($request);

if ($member_count 0)
{
if ($list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" height="30px" style="margin-top: 4px;">
<td class="menubar" colspan="4" style="border: 1px solid #888888; padding-top: 4px;"><div align="center"><h2 style="margin-top: 0; margin-bottom: 0px;"><b>' 
$groupNameX '</b></h2></div>
</td></tr>'
;

echo '<tr>';
        $newrow=0;

foreach($context['TPortal']['team'] as $team)
        {
echo '
<td valign="top" width="18%">'
.$team['avatar']['image'].'</td>';

echo ' <td valign="top" class="middletext" style="padding: 2px;">';

echo '<h2 style="margin-top: 0; margin-bottom: 4px;"><b>'.$team['link'].'</b></h2>';

// echo '<b>'. $team['usertitle'].'</b><br />';

if (!$list_by_group)
echo '<b>'.$txt[87].'</b>: '.$team['groupname'].'<br />';

if ($modSettings['karmaMode'] == '1')
echo '<b>'$modSettings['karmaLabel'], '</b> '$team['karmagood'] - $team['karmabad'], '<br />';
elseif ($modSettings['karmaMode'] == '2')
echo '<b>'$modSettings['karmaLabel'], '</b> +'$team['karmagood'], ' | -'$team['karmabad'], '<br />';

echo '<b>'.$txt['lastLoggedIn'].'</b>: '.$team['last_login'].'<br />';

// echo !empty($team['location']) ? '<b>'.$txt[227].'</b>: '.$team['location'].'<br />' : '';

// echo !empty($team['website']['title']) ? '<b>'.$txt[96].'</b>: <a href="'.$team['website']['url'].'" target="_blank"><u>'.$team['website']['title'].'</u></a><br />' : '';

echo '<b>'.$txt[86].'</b>: '.$team['posts'].'<br />';

echo $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' $team['online']['text'].'<br />';

// echo !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '';

// echo !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '';

if (($extra_type == 'board') && !empty($team['member_page']))
echo '<a href="' $scripturl '?board=' $team['member_page'] . '"><u>'$extra_label_prefix $team['name'] . $extra_label_suffix '</u></a><br />';
if (($extra_type == 'page') && !empty($team['member_page']))
echo '<a href="' $scripturl '?page=' $team['member_page'] . '"><u>'$extra_label_prefix $team['name'] . $extra_label_suffix '</u></a><br />';

echo '
</td>'
;

$newrow++;
if($newrow>1){
$newrow=0;
echo '</tr><tr><td colspan="4"></td></tr><tr>';
}
        }
if($newrow=1) echo '<td colspan="2"></td>';
echo '</tr>';
}

}
echo 
'</table></table></div></td></tr></table>';
}
?>


But I don't no how to add the contact things into it, when I try, it don't work.
Things like email, msn, aim and other things.
Title: Re: Roster Page
Post by: jacortina on June 03, 2007, 02:23:56 AM
Where/how are you using this (the php tag won't work and function isn't necessary in a block or article)?

You need to find the column names in the members table for the things you want to show. Then you need to look in something like Load.php and Display.template.php for an example of how to generate and display the correct icons for them.


Get extra fields: mem.emailAddress, mem.hideEmail, mem.ICQ, mem.AIM, mem.YIM, mem.MSN.
Change:
SELECT 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 as memnum, mem.memberName, mem.ID_GROUP,
mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName


To:
SELECT 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 as memnum, mem.memberName, mem.ID_GROUP,
mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
mem.emailAddress, mem.hideEmail, mem.ICQ, mem.AIM, mem.YIM, mem.MSN,
mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName



Generate the array members -
Change:
'posts' => $row['posts'],
'karmabad' => $row['karmaBad'],
'karmagood' => $row['karmaGood'],
'location' => $row['location'],


To:
'posts' => $row['posts'],
'karmabad' => $row['karmaBad'],
'karmagood' => $row['karmaGood'],
'location' => $row['location'],
'email' => $row['emailAddress'],
'hide_email' => $row['emailAddress'] == '' || (!empty($modSettings['guest_hideContacts']) && $user_info['is_guest']) || (!empty($row['hideEmail']) && !empty($modSettings['allow_hideEmail']) && !allowedTo('moderate_forum')),
'icq' => $row['ICQ'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array(
'link' => '<a href="http://www.icq.com/whitepages/about_me.php?uin=' . $row['ICQ'] . '" target="_blank"><img src="http://status.icq.com/online.gif?img=5&amp;icq=' . $row['ICQ'] . '" alt="' . $row['ICQ'] . '" width="18" height="18" border="0" /></a>',
) : array('link' => ''),
'aim' => $row['AIM'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array(
'link' => '<a href="aim:goim?screenname=' . urlencode(strtr($row['AIM'], array(' ' => '%20'))) . '&amp;message=' . $txt['aim_default_message'] . '"><img src="' . $settings['images_url'] . '/aim.gif" alt="' . $row['AIM'] . '" border="0" /></a>',
) : array('link' => ''),
'yim' => $row['YIM'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array(
'link' => '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row['YIM']) . '"><img src="http://opi.yahoo.com/online?u=' . urlencode($row['YIM']) . '&amp;m=g&amp;t=0" alt="' . $row['YIM'] . '" border="0" /></a>',
) : array('link' => ''),
'msn' => $row['MSN'] !='' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array(
'link' => '<a href="http://members.msn.com/' . $row['MSN'] . '" target="_blank"><img src="' . $settings['images_url'] . '/msntalk.gif" alt="' . $row['MSN'] . '" border="0" /></a>',
) : array('link' => ''),



Output the new fields -
Change:
if (($extra_type == 'board') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?board=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';
if (($extra_type == 'page') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?page=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';


To:
if (($extra_type == 'board') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?board=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';
if (($extra_type == 'page') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?page=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';
echo '
', $team['icq']['link'], '
', $team['msn']['link'], '
', $team['aim']['link'], '
', $team['yim']['link'], ' ';

// Don't show the email address if they want it hidden.
if (empty($team['hide_email']))
echo '
<a href="mailto:', $team['email'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt[69] . '" title="' . $txt[69] . '" border="0" />' : $txt[69]), '</a>';

Title: Re: Roster Page
Post by: Velocity on June 03, 2007, 02:35:02 AM
Thanks, I'm using php cause it's set up like a page with a template. Like a page added through a mod. It's not in a block or article :)
Title: Re: Roster Page
Post by: Earache on June 05, 2007, 07:11:09 PM
I'm using londonhogfan's snippet from page 13, i'm trying to add code to it so it will display secondary groups but, i keep getting php and sql errors when I try adding

$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'] . " OR FIND_IN_SET(".$data['id'].", additionalGroups) ", __FILE__, __LINE__);


Can someone help?
Title: Re: Roster Page
Post by: richtofen on June 22, 2007, 04:09:33 PM
am trying to add this mod to my page but every time i try to add the Staff mod i get an error....when i try to install this mod there is a message modification error staff.xml

Fatal error: require() [function.require]: Failed opening required '/www/yeahost.com/r/richtofen.yeahost.com/forum/Packages/temp/./staffsql.php' (include_path='.:/opt/php5/lib/php') in /www/yeahost.com/r/richtofen.yeahost.com/forum/Sources/Packages.php on line 552


can anyone help me? am new with this but am trying....thanks
Title: Re: Roster Page
Post by: IchBin on June 22, 2007, 04:37:27 PM
For support on the staff mod you should seek help from the mod author.
Title: Re: Roster Page
Post by: richtofen on June 22, 2007, 07:17:40 PM
can anyone put some kind of tutorial of what we have todo to put this block??

thanks
Title: Re: Roster Page
Post by: IchBin on June 23, 2007, 05:30:37 AM
Thats what the original post is.
Title: Re: Roster Page
Post by: richtofen on June 23, 2007, 06:00:24 AM
it is only to add one article and put that code in php?
Title: Re: Roster Page
Post by: IchBin on June 23, 2007, 06:04:41 AM
Well it won't fit in a block. There's too much info to bunch in a block unless you put it in a center or frontpage block. Simply add a center phpbox block and put the code in. Its that simple really. Don't hesitate to give things a shot. :)
Title: Re: Roster Page
Post by: richtofen on June 23, 2007, 06:21:37 AM
ok....when i put my staff mod to work i will try :)
Title: Re: Roster Page
Post by: richtofen on June 29, 2007, 06:53:15 PM
i have here the staff mod instaled how can i put the roster mod....i have to copy that code and put it were..can anyone(ichbin) explain??....ehhe...thanks
Title: Re: Roster Page
Post by: IchBin on June 29, 2007, 07:23:58 PM
I could perhaps explain how to, but why reinvent the wheel? :)

Everything you need to know is in the first post.
QuoteI entered the following code into an article (php) page to get this.
http://www.the-rota.com/?page=30
Title: Re: Roster Page
Post by: richtofen on June 29, 2007, 11:07:15 PM
ok ich and how about the playlist that has in the user profile in the-rota site....do u know here i can find it?
Title: Re: Roster Page
Post by: JOSHSKORN on July 05, 2007, 02:27:46 AM
I'm using a modification of JPDeni's code.  I took out a few things.  I couldn't figure out exactly a few things:


Quote
The Ranking System
Clan Members: All of our members have RCON. They can moderate the forums, but not delete entire threads. These are full clan members and may be assigned a duty upon request or as needed. Founders of our clan and selected members have been granted additional administrative privileges, but do not hold any higher precedence in any inner-clan discussions.

Recruits: Brand new recruits. New members must serve as a recruit for 30 days prior to becoming a Clan Member. During this time, we observe their commitment to our clan, attitude and teach them a few things.

Inactive Reserve: These are members we have not seen around in a few weeks. This rank is used simply as a marker in determining how many active players we have. Inactive Reservists are not treated as inferior to active members.

Yes I did simply try pasting it under my php code and got errors.

Here is my current code for the article:

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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  'Members',
  'Recruits',
  'Inactive Reserve'
);

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $query2 = db_query("
     SELECT ID_GROUP, ID_MEMBER, realName, emailAddress, hideEmail, lastLogin, location, personalText,
           totalTimeLoggedIn, dateRegistered, ICQ, AIM, YIM, MSN,
           hideEmail, emailAddress
    FROM {$db_prefix}members
    WHERE ID_GROUP = '" . $groups[$rank]['id'] . "'
    ORDER BY realName", __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>';
      echo '<td class="catinfo" width="270"><b>Member Name</b></td>';
      echo '<td class="catinfo" width="170"><b>Last Online</b></td>';
      echo '<td class="catinfo" width="100"><b>Location</b></td>';
      echo '<td class="catinfo" width="175"><b>Contact</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b>';

        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '<i>' . $row2['location'] . '</i>';
        echo '</td><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> ';

//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><br>';
  }
}
Title: Re: Roster Page
Post by: Bloodlvst on August 23, 2007, 06:57:32 AM
Figured out most of this myself.
Title: Re: Roster Page
Post by: Bloodlvst on August 24, 2007, 05:36:13 AM
Alright, if you read my previous post... yeah... messed up.

I figured out how to going about doing most of what I posted previously, just have a few questions on how to do the following.

First off, I followed JPDeni's instructions EXACTLY...but for some reason it's not working. Even though my secondary group is 'Joint Chief' the roster page shows nothing. It only works when I set my primary to be Joint Chief, which I do not want. So any help on making this work would be most appreciated.

I have another question, but I want to solve this one first. Baby steps :D

http://www.aoagaming.org/index.php?page=6

Here's my code:
global $db_prefix, $scripturl, $txt, $settings, $options;


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces. (I notice that "Major" is missing.)
$rankorder = array(
  'Joint Chief',
);

$team[10] = '[CAL1]';
$team[11] = '[CAL2]';
$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

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

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="245"><b>GAMING ALIAS</b></td>';
      echo '<td class="catinfo" width="130"><b>NAME</b></td>';
      echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
        echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '">AoA`<b><font size="3" face="verdana">' . $row2['realName'] . '</b>';   
          if ($row2['additionalGroups'] <> '' )
            {
            $addl = explode(',',$row2['additionalGroups']);
            foreach ($team as $key => $value)
              {
              if (in_array($key,$addl))
              echo ' '. $value . ' ';
              }
            }
        echo ' '. $team[$row2['additionalGroups']] . ' ';
        echo '</font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . $row2['usertitle'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';

//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> ';

//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><br>';
  }
}
Title: Re: Roster Page
Post by: jacortina on August 24, 2007, 01:50:00 PM
Try changing:
    WHERE ID_GROUP = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);

To:
    WHERE ID_GROUP = '" . $groups[$rank]['id'] . "'" .
       " OR FIND_IN_SET(" . $groups[$rank]['id'] . ", additionalGroups)", __FILE__, __LINE__);


The original query only selects members whose primary group (ID_GROUP) matches the given group ID. You also want to select those who have that ID in their 'additionalGroups'.
Title: Re: Roster Page
Post by: Bloodlvst on August 24, 2007, 02:10:52 PM
Quote from: J.A.Cortina on August 24, 2007, 01:50:00 PM
Try changing:
    WHERE ID_GROUP = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);

To:
    WHERE ID_GROUP = '" . $groups[$rank]['id'] . "'" .
       " OR FIND_IN_SET(" . $groups[$rank]['id'] . ", additionalGroups)", __FILE__, __LINE__);


The original query only selects members whose primary group (ID_GROUP) matches the given group ID. You also want to select those who have that ID in their 'additionalGroups'.

I'm at work right now, but as soon as I get home I'll try out that edit. Thanks for your help!
Title: Re: Roster Page
Post by: Bloodlvst on August 24, 2007, 02:16:00 PM
Decided to sneak aorund and try it...it worked! Except for one thing, hopefully non -admins on my site can see it, but I'm getting an error message right after it. :(

http://www.aoagaming.org/index.php?page=6
Title: Re: Roster Page
Post by: G6Cad on August 24, 2007, 02:36:28 PM
I see the error as guest to
QuoteDatabase Error
Please try again. If you come back to this error screen, report the error to an administrator.
Title: Re: Roster Page
Post by: Bloodlvst on August 24, 2007, 02:44:40 PM
Thanks G6! Well here's the error code I get.

QuoteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' additionalGroups)' at line 6
File: /home/musikpro/public_html/aoagaming/Sources/Load.php(1735) : eval()'d code(209) : eval()'d code
Line: 69
Title: Re: Roster Page
Post by: jacortina on August 24, 2007, 04:02:41 PM
As it seems to be generating the first entry correctly, I think it may have something to do with how you have your rank list set up:

$rankorder = array(
  'Joint Chief',
);


Try removing the comma after the joint Chief value (I think this may be generating an array entry with a null value which makes the 'foreach' loop execute a second time with an undefined group name/ID).
Title: Re: Roster Page
Post by: Bloodlvst on August 24, 2007, 05:28:07 PM
Quote from: J.A.Cortina on August 24, 2007, 04:02:41 PM
As it seems to be generating the first entry correctly, I think it may have something to do with how you have your rank list set up:

$rankorder = array(
  'Joint Chief',
);


Try removing the comma after the joint Chief value (I think this may be generating an array entry with a null value which makes the 'foreach' loop execute a second time with an undefined group name/ID).

I removed the comma, then got the error:
QuoteParse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/musikpro/public_html/aoagaming/Sources/Load.php(1735) : eval()'d code(209) : eval()'d code on line 9

Should I remove any ranks I get after?

Here's my code on that part:
$rankorder = array(
  'Joint Chief'
  'Brigadier General',
  'Colonel',
  'Lieutenant Colonel',
  'Captain',
  '1st Lieutenant',
  'Sergeant Major',
  'First Sergeant',
  'Master Sergeant',
  'Staff Sergeant',
  'Sergeant',
  'Corporal',
  'Lance Corporal',
  'Private First Class',
  'Private'
);


Title: Re: Roster Page
Post by: jacortina on August 24, 2007, 05:48:00 PM
You keep presenting a moving target. I was talking about the code shown above (your post at the top of this thread's page 21) where you only had 1 group name shown and it was followed by a comma.

All the names in this latest code should be followed by commas EXCEPT the last one.
Title: Re: Roster Page
Post by: Bloodlvst on August 24, 2007, 05:53:12 PM
Okay but I had the list liek the before with a comma. Sorry, I'm proably just being dumb here lol. Could it be becuase on my forum the other membergroups don't really exist, so they're not even taken into consideration?
Title: Re: Roster Page
Post by: jacortina on August 24, 2007, 06:26:57 PM
The code you're using first gets the group ID from the group name and then queries to find members using that group ID. If that group ID is blank or null because the name doesn't correspond to any groups, then that could indeed be giving you the problems.
Title: Re: Roster Page
Post by: Bloodlvst on August 24, 2007, 06:31:47 PM
Alright, works! Thank you so much for your support and patience!

If you don't feel like helping with this issue it's fine, just something I can't help but ask if it can be done!

Since we have different teams, they all use the same type of ranks, but their rank in one group may be different from the main roster. Would there be a way that if I had ranks CS Joint Chief, BW Joint Chief, that the CS  or WoW  part could be removed from the roster display. Is it even possible?
Title: Re: Roster Page
Post by: jacortina on August 24, 2007, 07:10:15 PM
Frankly, if I had to try this, I'd say that you might simply consider making extra member groups and add all the "Joint Chief" members, no matter their team, to a "Joint Chief" membergroup and then key on that.

Other than that, you may have to highly customize the page and make it really problematic to show more than one of these "consolidated rank lists" on any one page.
Title: Re: Roster Page
Post by: Bloodlvst on August 24, 2007, 07:21:28 PM
Hmmm I get where you're going. Well I'll try some stuff and see where it takes me.

Thanks for getting me to this point though, I really appreciate it!
Title: Re: Roster Page
Post by: Hairy on September 07, 2007, 11:19:24 AM
OK the best one for me I have found here so far is the following:

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

if (isset($_GET['rteam']))
  $rteam = ' AND FIND_IN_SET('. $_GET['rteam'] . ',additionalGroups)';
else
  $rteam = '';

// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  'Administrator',
  'Global Moderator',
  'Server Admin',
  'Server Deputy',
  'Recruiter',
  'Battle Manager',
  'Article Manager',
  '2.8.1 Squad Leader',
//  '2.8.1 Clan Member',
  '2.6 Squad Leader',
  '2.6 Clan Member',
//  'Clan Member',
);

$team[10] = '';
$team[11] = '';
$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $query2 = db_query("
    SELECT ID_GROUP, ID_MEMBER, realName, avatar, memberName, usertitle,
           emailAddress, hideEmail, lastLogin, location, personalText,
           totalTimeLoggedIn, dateRegistered, ICQ, AIM, YIM, MSN,   
           hideEmail, emailAddress, additionalGroups
    FROM {$db_prefix}members
    WHERE ID_GROUP = '" . $groups[$rank]['id'] . "'" .
       " OR FIND_IN_SET(" . $groups[$rank]['id'] . ", additionalGroups)", $rteam, __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="245"><b>GAMING ALIAS</b></td>';
      echo '<td class="catinfo" width="130"><b>NAME</b></td>';
      echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
        echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font size="3" face="verdana">' . $row2['realName'] . '</b>';   
          if ($row2['additionalGroups'] <> '' )
            {
            $addl = explode(',',$row2['additionalGroups']);
            foreach ($team as $key => $value)
              {
              if (in_array($key,$addl))
              echo ' '. $value . ' ';
              }
            }
        echo ' '. $team[$row2['additionalGroups']] . ' ';
        echo '</font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . $row2['memberName'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="left">';

//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> ';

//Send PM row
        echo '<a href="' . $scripturl . '?action=pm;sa=send;u=' . $row2['ID_MEMBER'] . '"><img src="' . $settings['images_url'] . '/im_on.gif" alt="PM" /></a></a>';
        echo '</td>';
        echo '</tr>';
      }
    echo '</table><br>';
  }
}


But what I want to do is change the "Last Online" part to show the "local time" of the member it is displaying, it would be awesome if anyone knows what to do.

I'm very new to this stuff and had a fiddle but only ended up making it display the local time of the person who is viewing the roster (displayed the same time for everyone) I deleted that so can't remember what I used now  :uglystupid2:
Title: Re: Roster Page
Post by: JOSHSKORN on September 10, 2007, 09:11:31 AM
Can someone help me customize this thing?  Let me explain overall what I want, and maybe someone can help put the pieces together.

Member Name, Online, Location, Favorite Game, Xfire

More Info:

Online: Show the member online or member offline image
Location: country flag mod

Favorite Games: A selection from a drop-down list.  I have Custom Profile Fields mod installed where I made a list.  This particular field is called CPGameList.  I'd like this column to check for the selection, and then display the appropriate image (i.e. halo.jpg, halo2.jpg, bf2142.jpg, etc.).  Choices in this list are: Halo, Halo 2, Battlefield 2142.  I'd expand the list myself eventually but I'd need a way to get started.  Let me know where exactly to place the images, too.

XFire: there's an xfire mod I know of, I just haven't installed it. It will only place the small xfire image next to your name in forum posts if you specify your username.  What I'm looking to do, is take this field and generate an xfire image that will display the player's game stats.

Here's sample code generated from xfire.com

<a href="http://profile.xfire.com/myusername"><img src="http://miniprofile.xfire.com/bg/co/type/0/myusername.png" width="440" height="111" /></a>

myusername would have to be replaced with the entry in the xfire profile field.  If no xfire exists, maybe a message saying "Player does not have xfire".

I would have no idea how to code this thing.

Attached is my current Roster, showing: Member Name (display name), and three columns that I don't want: Last Online, Location (city state and country I think), and Contact Info.

If someone could help that would be great!
Title: Re: Roster Page
Post by: iGate on September 20, 2007, 02:12:56 PM
is there a way i can add a contrained sized avatar to my roster?.

http://test.ihf.lp.pl/forums/index.php?page=11
i want to use this script:


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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  '=IHF=Administrator',
  '=IHF= Server Admin',
  '=IHF= Forum G. Mod',
  '=IHF= Forum Moderator',
  '=IHF= Member',
  );

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $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 = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="270"><b>Name</b></td>';
      echo '<td class="catinfo" width="130"><b>N1AME</b></td>';
      echo '<td class="catinfo" width="170"><b>Last Online</b></td>';
      echo '<td class="catinfo" width="100"><b>Location</b></td>';
      echo '<td class="catinfo" width="175"><b>Contact</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b>';

echo '</font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . $row2['usertitle'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '<i>' . $row2['location'] . '</i>';
        echo '</td><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> ';

//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><br>';
  }
}
Title: Re: Roster Page
Post by: Mike- on September 21, 2007, 09:25:51 AM
I got the code to work fine. Just one little problem, I am using the Mirage - Revised theme, and there is a function under 'Portal' that says Team Page. How would I get the roster to show up when someone clicks that button?
Title: Re: Roster Page
Post by: Hairy on September 21, 2007, 02:52:54 PM
I'm not sure if this applies to what you are talking about:

Tiny Portal Team page is a feature that is not yet implemented, it might be used in the future.

But you can still do something else, in the TP block manager "add menu item" and point the new menu item to the roster article you created and name as you wish.

Then use "menu manager" to turn on the new menu item and tick the box "sitemap"

Now you should a link for it on your front page
Title: Re: Roster Page
Post by: TimUSA on October 04, 2007, 09:08:00 PM
When using the code four here: http://www.tinyportal.net/index.php?topic=5423.msg63479#msg63479

I get this. Anyone know why it is creating the end of this table offset?

Solved this was happening in this line:
<tr><td rowspan="70" width="10" class="profilebg" valign="top">

and I changed to this:
<tr><td rowspan="100" width="10" class="profilebg" valign="top">
Title: Re: Roster Page
Post by: Hairy on October 05, 2007, 12:34:18 AM
Did you modify the code at all?

I tested the code in question and it works perfectly for me.

You may want to post the code if you have modified in any way otherwise ask for support in the support area in case it is something else causing this.

Cheers
Title: Re: Roster Page
Post by: kaburan on October 11, 2007, 06:01:49 AM
Hello folks,

I'm having one hell of a time trying to perform only one thing with the code I am using. I am trying to utilize both Custom Profile Fields Mod with the Roster Script. Note, I am only uzing one custom profile field and thats to allow a member to select which Division they are in. The division in turn needs to be displayed on the roster. Instead, I end up getting a

Quote
Unknown column 'CP1' in 'field list'
File: /var/www/vhosts/vx9.com/httpdocs/forums/Sources/Load.php(1750) : eval()'d code(209) : eval()'d code
Line: 52

I have searched for assistance, I have searched the boards, I have been to a breaking point on this yet I wont give up. If I could have any of you take a look at this code and assist me I would highly appreciate it.
So, I have my code here



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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  'General',
  'Lieutenant General',
  'Major General',
  'Brigadier General',
  'Colonel',
  'Lieutenant Colonel',
  'Major',
  'Captain',
  '1st Lieutenant',
  '2nd Lieutenant',
  'Sergeant Major',
  'First Sergeant',
  'Sergeant First Class',
  'Staff Sergeant',
  'Sergeant',
  'Corporal',
  'Private First Class',
  'Private',
  'Recruit',
);

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $query2 = db_query("
     SELECT ID_GROUP, ID_MEMBER, realName, avatar, usertitle,
           emailAddress, hideEmail, lastLogin, location, CP1, personaltext,
           totalTimeLoggedIn, dateRegistered, ICQ, AIM, YIM, MSN,
           hideEmail, emailAddress
    FROM {$db_prefix}members
    WHERE ID_GROUP = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="270"><b>ALIAS</b></td>';
      echo '<td class="catinfo" width="130"><b>DIVISION</b></td>';
      echo '<td class="catinfo" width="175"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="100"><b>LOCATION</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b>';

echo '</font></font></a><br><font size="1"> ' . $row2['personaltext'] . '</font></a></td><td class="windowbg">' . $row2['CP1'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg" align="center">';       
echo '<i>' . $row2['location'] . '</i>';
        echo '</td><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> ';

//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><br>';
  }
}




And here is where I am trying to pull the Division Field from the database. CP1 is the Field ID I had set the field to, and from searching and scouring through both SMF and Tinyportals boards, CP1 is what everyones been using.


mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $query2 = db_query("
     SELECT ID_GROUP, ID_MEMBER, realName, avatar, usertitle,
           emailAddress, hideEmail, lastLogin, location, CP1, personaltext,
           totalTimeLoggedIn, dateRegistered, ICQ, AIM, YIM, MSN,
           hideEmail, emailAddress
    FROM {$db_prefix}members
    WHERE ID_GROUP = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="270"><b>ALIAS</b></td>';
      echo '<td class="catinfo" width="130"><b>DIVISION</b></td>';
      echo '<td class="catinfo" width="175"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="100"><b>LOCATION</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b>';

echo '</font></font></a><br><font size="1"> ' . $row2['personaltext'] . '</font></a></td><td class="windowbg">' . $row2['CP1'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg" align="center">';       
echo '<i>' . $row2['location'] . '</i>';
        echo '</td><td class="windowbg">';


Title: Re: Roster Page
Post by: jacortina on October 11, 2007, 02:14:13 PM
Custom Profile Fields aren't stored in the 'members' table, they're stored in the 'themes' table. And even there, that 'CP1' is NOT a column name, it's part of the key value by which entries are referenced.

The 'themes' table has the columns: ID_MEMBER, ID_THEME, variable, value.

I believe that Custom Profile Fields are stored with ID_THEME = 1.

So, to pull the CP1 information for member # 123, you need to"

SELECT value FROM {db_prefix}themes
WHERE ID_MEMBER = 123
  AND ID_THEME = 1
  AND variable = "CP1"
Title: Re: Roster Page
Post by: kaburan on October 11, 2007, 03:13:54 PM
Ok so as I understand, I can only pull it for one person at a time? I'm not sure I follow you but I do understand what you mean by the fact that CP is stored in the themes table. So how could I apply the code you've provided to automatically fill the table value for each member?

You can see what I mean on my site at http://www.vx9.com/forums/index.php?page=Roster
Title: Re: Roster Page
Post by: jacortina on October 11, 2007, 03:45:01 PM
Well, you should try to avoid too many individual queries (when possible). But then, you have to work on less straightforward queries to get all of the info you want (and none you don't).

In this case, I believe you want to use what's called a "left join".

Try this in place of your $query2:
  $query2 = db_query("
     SELECT mem.ID_GROUP, mem.ID_MEMBER, mem.realName, mem.avatar, mem.usertitle,
           mem.emailAddress, mem.hideEmail, mem.lastLogin, mem.location, mem.personaltext,
           mem.totalTimeLoggedIn, mem.dateRegistered, mem.ICQ, mem.AIM,
           mem.YIM, mem.MSN, th.value as CP1
    FROM {$db_prefix}members as mem
    LEFT JOIN {db_prefix}themes as th on (mem.ID_MEMBER = th.ID_MEMBER AND th.ID_THEME = 1 AND th.variable = 'CP1')
    WHERE mem.ID_GROUP = '" . $groups[$rank]['id'] . "'", __FILE__, __LINE__);


Note that I haven't (and really can't) test this query
Title: Re: Roster Page
Post by: kaburan on October 11, 2007, 04:58:16 PM
I replaced the Query 2 with your suggested code only to end up with.

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '}themes as th on (mem.ID_MEMBER = th.ID_MEMBER AND th.ID_THEME = 1 AND th.variab' at line 6"
Title: Re: Roster Page
Post by: Innocenzia on October 11, 2007, 06:44:08 PM
Is it possible to sort multiple membergroups into the same part. If so, how is it possible? a code-example would be great!

I would like it sorted like this:

Admins
[here goes Administrator & Global Moderator]

Members
[here goes Members]

Newbie
[here goes Members with the post-based level Newbie]

Inactive
[Members who hasn't logged in for the last 10 days]
Title: Re: Roster Page
Post by: jacortina on October 11, 2007, 07:15:44 PM
Hmm. It appears that "th" was a no-no.

This seems to have it working:
  $query2 = db_query("
     SELECT mem.ID_GROUP, mem.ID_MEMBER, mem.realName, mem.avatar, mem.usertitle,
           mem.emailAddress, mem.hideEmail, mem.lastLogin, mem.location, mem.personaltext,
           mem.totalTimeLoggedIn, mem.dateRegistered, mem.ICQ, mem.AIM,
           mem.YIM, mem.MSN, thm.value as CP1
    FROM {$db_prefix}members AS mem
           LEFT JOIN {$db_prefix}themes AS thm ON (thm.ID_MEMBER = mem.ID_MEMBER AND thm.ID_THEME = 1 AND thm.variable = 'CP1')
    WHERE mem.ID_GROUP = " . $groups[$rank]['id'], __FILE__, __LINE__);
Title: Re: Roster Page
Post by: jacortina on October 11, 2007, 07:23:00 PM
Quote from: Innocenzia on October 11, 2007, 06:44:08 PM
Is it possible to sort multiple membergroups into the same part. If so, how is it possible? a code-example would be great!

I would like it sorted like this:

Admins
[here goes Administrator & Global Moderator]

Members
[here goes Members]

Newbie
[here goes Members with the post-based level Newbie]

Inactive
[Members who hasn't logged in for the last 10 days]

This code won't do that.

You can look at the code in the "Team Page thread" which will do some of that:
http://www.tinyportal.net/index.php?topic=9207.0

But, "inactive" isn't a membergroup and are 'Members" those who aren't in any membergroup or all membegroups EXCEPT Admins and Group Moderators (and not in Post Group Newbie) or what?
Title: Re: Roster Page
Post by: Innocenzia on October 11, 2007, 07:30:30 PM
I call one of the Membergroups (everyone has a group) for Members, so it's a group on my site. So members of other groups will not show up at all. or possibly in another section called Unsorted, but i'll take a look at Team Page then. :) Thanks.
Title: Re: Roster Page
Post by: TimUSA on October 12, 2007, 09:02:47 AM
Ok I have searched this entire thread and have not been able to find it. I would like to implement the Country Flag Mod into this code, in the place of "Location." The coding in the last few replies regarding custom profile fields was very helpful by the way :up:

I would also like to have it sort alpha by member name???

This is my code so far:

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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  'Administrator',
  'Vice Commodore',
  'Fleet Captain',
  'Board Member',
  'Racing Fleet Member',
);

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
   $query2 = db_query("
     SELECT mem.ID_GROUP, mem.ID_MEMBER, mem.realName, mem.usertitle,
           mem.emailAddress, mem.hideEmail, mem.lastLogin, mem.location, mem.personaltext,
           mem.totalTimeLoggedIn, mem.dateRegistered, mem.ICQ, mem.AIM,
           mem.YIM, mem.MSN, thm.value as sail
    FROM {$db_prefix}members AS mem
           LEFT JOIN {$db_prefix}themes AS thm ON (thm.ID_MEMBER = mem.ID_MEMBER AND thm.ID_THEME = 1 AND thm.variable = 'sail')
    WHERE mem.ID_GROUP = " . $groups[$rank]['id'], __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="1" align="center" class="bordercolor">
      <tr><td colspan="0" class="catbg"><font size="2" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="100" width="10" class="profilebg" valign="top">
</td>';
      echo '<td class="catinfo" width="270"><b>MEMBER NAME</b></td>';
      echo '<td class="catinfo" width="130"><b>SAIL NUMBER</b></td>';
      echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="100"><b>LOCATION</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="20"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="2" face="verdana">' . $row2['realName'] . '</b>';
echo '</font></font></a><br><font size="1"> ' . $row2['personaltext'] . '</font></a></td><td class="windowbg">' . $row2['sail'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '</font></font></a><br><font size="2"> ' . '<i>' . $row2['location'] . '</i>';
        echo '</td><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> ';

//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><br>';
  }
}
Title: Re: Roster Page
Post by: jacortina on October 12, 2007, 02:34:34 PM
Try changing:
    WHERE mem.ID_GROUP = " . $groups[$rank]['id'], __FILE__, __LINE__);


To:
    WHERE mem.ID_GROUP = " . $groups[$rank]['id'] . "
    ORDER BY mem.realName", __FILE__, __LINE__);
Title: Re: Roster Page
Post by: TimUSA on October 12, 2007, 06:10:11 PM
This worked. Thanks so much!
Title: Re: Roster Page
Post by: TimUSA on October 16, 2007, 12:32:11 AM
still having trouble finding how to add the country flag mod? any ideas?
Title: Re: Roster Page
Post by: jacortina on October 16, 2007, 12:50:27 AM
Have you looked in the themes table (phpMyAdmin) and checked what's actually in the value column for those with variable = 'sail'? If you can show me what's there, I may be able to tell you how to use it.
Title: Re: Roster Page
Post by: TimUSA on October 16, 2007, 01:10:41 AM
I believe this is the feild i would like to add in the crrent location column
Title: Re: Roster Page
Post by: jacortina on October 16, 2007, 01:22:21 AM
So, it looks like the first thing to do is to change this line:
           LEFT JOIN {$db_prefix}themes AS thm ON (thm.ID_MEMBER = mem.ID_MEMBER AND thm.ID_THEME = 1 AND thm.variable = 'sail')


To:
           LEFT JOIN {$db_prefix}themes AS thm ON (thm.ID_MEMBER = mem.ID_MEMBER AND thm.ID_THEME = 1 AND thm.variable = 'country')


Now, somewhere you supposedly have an image file named "us" (.gif/.jpg/.png). Along with images for the other flags. What is the directory and what is the extension used?
Title: Re: Roster Page
Post by: TimUSA on October 16, 2007, 01:28:18 AM
1. assuming i need both feilds, i would add another left join for the country feild correct?

2. then i would change this line:
        echo '</font></font></a><br><font size="2"> ' . '<i>' . $row2['location'] . '</i>';

to this:
        echo '</font></font></a><br><font size="2"> ' . '<i>' . $row2['country'] . '</i>';

am i on the right path?

the image file directory would be:
http://vsk-ayc.totalh.com/Themes/default/images/flags/us.png
Title: Re: Roster Page
Post by: jacortina on October 16, 2007, 01:51:40 AM
Quote from: TimUSA on October 16, 2007, 01:28:18 AM1. assuming i need both feilds, i would add another left join for the country feild correct?

Nope. You just need to know that 'country' is the variable 'name' which will hold the value that you want.

Quote from: TimUSA on October 16, 2007, 01:28:18 AM2. then i would change this line:
        echo '</font></font></a><br><font size="2"> ' . '<i>' . $row2['location'] . '</i>';

to this:
        echo '</font></font></a><br><font size="2"> ' . '<i>' . $row2['country'] . '</i>';

am i on the right path?

the image file directory would be:
http://vsk-ayc.totalh.com/Themes/default/images/flags/us.png

Not quite. This line in the query:
          mem.YIM, mem.MSN, thm.value as sail
puts the read-in value into a field named 'sail'. What follows assume it stays that way (if you want to change it to 'flag', it might make more sense; just change any appearance of 'sail' below to 'flag').

That means that the array entry you'll work with is $row['sail']. But if you just echo'ed that out, all you'd see is the letters "us" (or the corresponding names for other countries). You need to consruct an img:
'<img src="'.$settings['default_images_url'].'/flags/'.$row['sail'].'.png" />'

So, try changing the line:
        echo '</font></font></a><br><font size="2"> ' . '<i>' . $row2['location'] . '</i>';

To:
        echo '</font></font></a><br><font size="2"> ' . '<img src="'.$settings['default_images_url'].'/flags/'.$row['sail'].'.png" />';
Title: Re: Roster Page
Post by: TimUSA on October 16, 2007, 02:22:02 AM
I think we are on the same path together, but we are missing something. I need both 'sail' and 'country' So I was assuming that I would need to ad another left join statement. Apparently this doesn't work because i get a syntax error. I have added the correct echo statement to my current code, but am missing the query statement for 'country'. here is everything I have so far:

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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  'Administrator',
  'Vice Commodore',
  'Fleet Captain',
  'Board Member',
  'Racing Fleet Member',
);

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
   $query2 = db_query("
     SELECT mem.ID_GROUP, mem.ID_MEMBER, mem.realName, mem.usertitle,
           mem.emailAddress, mem.hideEmail, mem.lastLogin, mem.location, mem.personaltext,
           mem.totalTimeLoggedIn, mem.dateRegistered, mem.ICQ, mem.AIM,
           mem.YIM, mem.MSN, thm.value as sail
    FROM {$db_prefix}members AS mem
           LEFT JOIN {$db_prefix}themes AS thm ON (thm.ID_MEMBER = mem.ID_MEMBER AND thm.ID_THEME = 1 AND thm.variable = 'sail')
        WHERE mem.ID_GROUP = " . $groups[$rank]['id'] . "
    ORDER BY mem.realName", __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="1" align="center" class="bordercolor">
      <tr><td colspan="0" class="catbg"><font size="2" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="100" width="10" class="profilebg" valign="top">
</td>';
      echo '<td class="catinfo" width="270"><b>MEMBER NAME</b></td>';
      echo '<td class="catinfo" width="130"><b>SAIL NUMBER</b></td>';
      echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="100"><b>LOCATION</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="20"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="2" face="verdana">' . $row2['realName'] . '</b>';
echo '</font></font></a><br><font size="1"> ' . $row2['personaltext'] . '</font></a></td><td class="windowbg">' . $row2['sail'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '</font></font></a><br><font size="2"> ' . '<img src="'.$settings['default_images_url'].'/flags/'.$row['country'].'.png" />';
        echo '</td><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> ';

//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><br>';
  }
}


I am guessing that we are helping more than one by solving this problem. I sure do appreciate your help.

Tim

Title: Re: Roster Page
Post by: jacortina on October 16, 2007, 02:37:50 AM
Yes, you'll need another join. Use the code you show, but try changing the query to:
    SELECT mem.ID_GROUP, mem.ID_MEMBER, mem.realName, mem.usertitle,
          mem.emailAddress, mem.hideEmail, mem.lastLogin, mem.location, mem.personaltext,
          mem.totalTimeLoggedIn, mem.dateRegistered, mem.ICQ, mem.AIM,
          mem.YIM, mem.MSN, thm.value as sail, thm2.value as country
   FROM {$db_prefix}members AS mem
          LEFT JOIN {$db_prefix}themes AS thm ON (thm.ID_MEMBER = mem.ID_MEMBER AND thm.ID_THEME = 1 AND thm.variable = 'sail')
          LEFT JOIN {$db_prefix}themes AS thm2 ON (thm.ID_MEMBER = mem.ID_MEMBER AND thm.ID_THEME = 1 AND thm.variable = 'country')
       WHERE mem.ID_GROUP = " . $groups[$rank]['id'] . "
   ORDER BY mem.realName", __FILE__, __LINE__);
Title: Re: Roster Page
Post by: TimUSA on October 16, 2007, 03:12:17 AM
showing as a blank column
Title: Re: Roster Page
Post by: jacortina on October 16, 2007, 03:14:51 AM
Well, could be (hope it is) my messing up that second JOIN line. All the "thm"s should be "thm2"s in the second JOIN line:
          LEFT JOIN {$db_prefix}themes AS thm2 ON (thm2.ID_MEMBER = mem.ID_MEMBER AND thm2.ID_THEME = 1 AND thm2.variable = 'country')
Title: Re: Roster Page
Post by: TimUSA on October 16, 2007, 03:35:21 AM
ok that is working, but not with the flags.

when i put this line in:
        echo '</font></font></a><br><font size="2"> ' . '<i>' . $row2['country'] . '</i>'

i get the country letters

when i put this code in:
        echo '</font></font></a><br><font size="2"> ' . '<img src="'.$settings['default_images_url'].'/flags/'.$row['country'].'.png" />';

I still get a blank column

It appears we have the query part solved, now we just need to pull in the image. I could live with out it, but what fun would that be!

Thanks again
Title: Re: Roster Page
Post by: jacortina on October 16, 2007, 03:49:57 AM
Could you try to display the page source of the result and find that image URL and see what it says (maybe too many slashes, maybe $settings['default_images_url'] isn't set or has a value I'm not expecting).
Title: Re: Roster Page
Post by: TimUSA on October 16, 2007, 04:16:54 AM
ok i dont know if this helps us, but this is how it is brought in on the profile.template.php

</tr><tr>
<td><b>', $txt['country_flag'], ':</b></td>
<td>';

// Did they select a flag?
if(isset($context['member']['options']['country']) && !empty($context['member']['options']['country']))
{
$flags = CountryFlag();
echo
$flags[$context['member']['options']['country']] . ' <img src="', $settings['default_theme_url'], '/images/flags/', $context['member']['options']['country'], '.png" alt="Country" />';
}

echo '
</td>
Title: Re: Roster Page
Post by: jacortina on October 16, 2007, 04:28:02 AM
Then you can try to use their form (except that I don't believe you can count on the those $context members being present unless/until the Profile page is loaded; so you'd still want to use the value from the dtabase which we DO know you're getting):

'<img src="', $settings['default_theme_url'], '/images/flags/', $row2['country'], '.png" alt="Country" />'

-----

Oh, Damn! Before that, you could try simply putting the right array name in (instead of the mistaken one I supplied). It SHOULD be "$row2 " and not "$row":
        echo '</font></font></a><br><font size="2"> ' . '<img src="'.$settings['default_images_url'].'/flags/'.$row2['country'].'.png" />';
Title: Re: Roster Page
Post by: TimUSA on October 16, 2007, 04:34:40 AM
changing to row2 worked...YOUR A HERO!!!!!!!!

Here is the code for anyone else to use. Just change the field names as needed:

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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  'Administrator',
  'Vice Commodore',
  'Fleet Captain',
  'Board Member',
  'Racing Fleet Member',
);

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
   $query2 = db_query("
    SELECT mem.ID_GROUP, mem.ID_MEMBER, mem.realName, mem.usertitle,
          mem.emailAddress, mem.hideEmail, mem.lastLogin, mem.location, mem.personaltext,
          mem.totalTimeLoggedIn, mem.dateRegistered, mem.ICQ, mem.AIM,
          mem.YIM, mem.MSN, thm.value as sail, thm2.value as country
   FROM {$db_prefix}members AS mem
          LEFT JOIN {$db_prefix}themes AS thm ON (thm.ID_MEMBER = mem.ID_MEMBER AND thm.ID_THEME = 1 AND thm.variable = 'sail')
          LEFT JOIN {$db_prefix}themes AS thm2 ON (thm2.ID_MEMBER = mem.ID_MEMBER AND thm2.ID_THEME = 1 AND thm2.variable = 'country')
       WHERE mem.ID_GROUP = " . $groups[$rank]['id'] . "
   ORDER BY mem.realName", __FILE__, __LINE__);
  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="1" align="center" class="bordercolor">
      <tr><td colspan="0" class="catbg"><font size="2" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="100" width="10" class="profilebg" valign="top">
</td>';
      echo '<td class="catinfo" width="270"><b>MEMBER NAME</b></td>';
      echo '<td class="catinfo" width="130"><b>SAIL NUMBER</b></td>';
      echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="100"><b>LOCATION</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="20"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="2" face="verdana">' . $row2['realName'] . '</b>';
echo '</font></font></a><br><font size="1"> ' . $row2['personaltext'] . '</font></a></td><td class="windowbg">' . $row2['sail'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '</font></font></a><br><font size="2"> ' . '<img src="'.$settings['default_images_url'].'/flags/'.$row2['country'].'.png" />';
        echo '</td><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> ';

//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><br>';
  }
}


Title: Re: Roster Page
Post by: Hairy on October 18, 2007, 04:34:20 AM
This is an excellent addition to my roster page, thank you very much. ;D

One addition I think would be nice is to have the Country name displayed when the mouse hovers above (alt= *code to get full Country name*) but I am not sure how to pull that from the database.

Again, very cool!

Cheers
Title: Re: Roster Page
Post by: jacortina on October 18, 2007, 01:56:19 PM
I don't know where (or even IF) the full country name is stored for all countries with flags. We get the file name for the flag, but that's it; and the file name for the flag of the United States is named 'us' (lower case). Sure, that name could be put in the alt tag (you could even do a blanket strtoupper() to make everything uppercase), but without having the data of full names, we can't provide the full names.
Title: Re: Roster Page
Post by: Hairy on October 19, 2007, 01:55:44 AM
I just checked the database and I could not find any country names stored so yeah you are correct, I thought there would be because when displaying the flag in forum posts the Country names are displayed.

The must be some sort of code added to convert the the flag names (us) etc. to their full names.

I'll investigate further over the weekend, would be nice to get that little extra feature going although it's not a big deal.
Title: Re: Roster Page
Post by: jacortina on October 19, 2007, 02:01:42 AM
You might want to take a quick look in the Modifications.english.php file. They could have been shoved in as extra $txt entries ($txt['us'] = 'United States'; ).
Title: Re: Roster Page
Post by: Hairy on October 19, 2007, 02:21:20 AM
I can't do a lot till I get home but I was able to look in the install.xml file in the package and found this:

- <file name="$sourcedir/Subs.php">
- <operation>
  <search position="end" />
- <add>
- <![CDATA[ function CountryFlag()
{
$flags = array(
'af' => 'Afghanistan', 'al' => 'Albania', 'dz' => 'Algeria',
'as' => 'American Samoa', 'ad' => 'Andorra', 'ao' => 'Angola',
'ai' => 'Anguilla', 'aq' => 'Antarctica', 'ag' => 'Antigua and Barbuda',
'ar' => 'Argentina', 'am' => 'Armenia', 'aw' => 'Aruba',
'au' => 'Australia', 'at' => 'Austria', 'az' => 'Azerbaijan',
'bs' => 'Bahamas', 'bh' => 'Bahrain', 'bd' => 'Bangladesh',
'bb' => 'Barbados', 'by' => 'Belarus', 'be' => 'Belgium',
'bz' => 'Belize', 'bj' => 'Benin', 'bm' => 'Bermuda',
'bt' => 'Bhutan', 'bo' => 'Bolivia', 'ba' => 'Bosnia and Herzegovina',
'bw' => 'Botswana', 'bv' => 'Bouvet Island', 'br' => 'Brazil',
'io' => 'British Indian Ocean Territory', 'bn' => 'Brunei Darussalam', 'bg' => 'Bulgaria',
'bf' => 'Burkina Faso', 'bi' => 'Burundi', 'kh' => 'Cambodia',
'cm' => 'Cameroon', 'ca' => 'Canada', 'cv' => 'Cape Verde',
'ky' => 'Cayman Islands', 'cf' => 'Central African Republic', 'td' => 'Chad',
'cl' => 'Chile', 'cn' => 'China', 'cx' => 'Christmas Island',
'cc' => 'Cocos (Keeling) Islands', 'co' => 'Colombia', 'km' => 'Comoros',
'cg' => 'Congo, Republic of the', 'cd' => 'Congo, The Democratic Republic of the', 'ck' => 'Cook Islands',
'cr' => 'Costa Rica', 'ci' => 'Côte d\'Ivoire', 'hr' => 'Croatia',
'cu' => 'Cuba', 'cy' => 'Cyprus', 'cz' => 'Czech Republic',
'dk' => 'Denmark', 'dj' => 'Djibouti', 'dm' => 'Dominica',
'do' => 'Dominican Republic', 'ec' => 'Ecuador', 'eg' => 'Egypt',
'sv' => 'El Salvador', 'gq' => 'Equatorial Guinea', 'er' => 'Eritrea',
'ee' => 'Estonia', 'et' => 'Ethiopia', 'fk' => 'Falkland Islands (Islas Malvinas)',
'fo' => 'Faroe Islands', 'fj' => 'Fiji', 'fi' => 'Finland',
'fr' => 'France', 'gf' => 'French Guiana', 'pf' => 'French Polynesia',
'tf' => 'French Southern Territories', 'ga' => 'Gabon', 'gm' => 'Gambia',
'ge' => 'Georgia', 'de' => 'Germany', 'gh' => 'Ghana',
'gi' => 'Gibraltar', 'gr' => 'Greece', 'gl' => 'Greenland',
'gd' => 'Grenada', 'gp' => 'Guadeloupe', 'gu' => 'Guam',
'gt' => 'Guatemala', 'gn' => 'Guinea', 'gw' => 'Guinea-Bissau',
'gy' => 'Guyana', 'ht' => 'Haiti', 'hm' => 'Heard Island and McDonald Islands',
'va' => 'Vatican City State', 'hn' => 'Honduras', 'hk' => 'Hong Kong',
'hu' => 'Hungary', 'is' => 'Iceland', 'in' => 'India',
'id' => 'Indonesia', 'ir' => 'Iran, Islamic Republic of', 'iq' => 'Iraq',
'ie' => 'Ireland, Republic of', 'il' => 'Israel', 'it' => 'Italy',
'jm' => 'Jamaica', 'jp' => 'Japan', 'jo' => 'Jordan',
'kz' => 'Kazakhstan', 'ke' => 'Kenya', 'ki' => 'Kiribati',
'kp' => 'Korea, Democratic People\'s Republic of', 'kr' => 'Korea, Republic of', 'kw' => 'Kuwait',
'kg' => 'Kyrgyzstan', 'la' => 'Lao People\'s Democratic Republic', 'lv' => 'Latvia',
'lb' => 'Lebanon', 'ls' => 'Lesotho', 'lr' => 'Liberia',
'ly' => 'Libyan Arab Jamahiriya', 'li' => 'Liechtenstein', 'lt' => 'Lithuania',
'lu' => 'Luxembourg', 'mo' => 'Macao', 'mk' => 'Macedonia, The Former Yugoslav Republic of',
'mg' => 'Madagascar', 'mw' => 'Malawi', 'my' => 'Malaysia',
'mv' => 'Maldives', 'ml' => 'Mali', 'mt' => 'Malta',
'mh' => 'Marshall Islands', 'mq' => 'Martinique', 'mr' => 'Mauritania',
'mu' => 'Mauritius', 'yt' => 'Mayotte', 'mx' => 'Mexico',
'fm' => 'Micronesia, Federated States of', 'md' => 'Moldova, Republic of', 'mc' => 'Monaco',
'mn' => 'Mongolia', 'ms' => 'Montserrat', 'ma' => 'Morocco',
'mz' => 'Mozambique', 'mm' => 'Myanmar', 'na' => 'Namibia',
'nr' => 'Nauru', 'np' => 'Nepal', 'nl' => 'Netherlands',
'an' => 'Netherlands Antilles', 'nc' => 'New Caledonia', 'nz' => 'New Zealand',
'ni' => 'Nicaragua', 'ne' => 'Niger', 'ng' => 'Nigeria',
'nu' => 'Niue', 'nf' => 'Norfolk Island', 'mp' => 'Northern Mariana Islands',
'no' => 'Norway', 'om' => 'Oman', 'pk' => 'Pakistan',
'pw' => 'Palau', 'ps' => 'Palestinian Territory, Occupied', 'pa' => 'Panama',
'pg' => 'Papua New Guinea', 'py' => 'Paraguay', 'pe' => 'Peru',
'ph' => 'Philippines', 'pn' => 'Pitcairn', 'pl' => 'Poland',
'pt' => 'Portugal', 'pr' => 'Puerto Rico', 'qa' => 'Qatar',
're' => 'Reunion', 'ro' => 'Romania', 'ru' => 'Russian Federation',
'rw' => 'Rwanda', 'sh' => 'Saint Helena', 'kn' => 'Saint Kitts and Nevis',
'lc' => 'Saint Lucia', 'pm' => 'Saint Pierre and Miquelon', 'vc' => 'Saint Vincent and the Grenadines',
'ws' => 'Samoa', 'sm' => 'San Marino', 'st' => 'Sao Tome and Principe',
'sa' => 'Saudi Arabia', 'sn' => 'Senegal', 'cs' => 'Serbia and Montenegro',
'sc' => 'Seychelles', 'sl' => 'Sierra Leone', 'sg' => 'Singapore',
'sk' => 'Slovakia', 'si' => 'Slovenia', 'sb' => 'Solomon Islands',
'so' => 'Somalia', 'za' => 'South Africa', 'gs' => 'South Georgia and the South Sandwich Islan',
'es' => 'Spain', 'lk' => 'Sri Lanka', 'sd' => 'Sudan',
'sr' => 'Suriname', 'sj' => 'Svalbard and Jan Mayen', 'sz' => 'Swaziland',
'se' => 'Sweden', 'ch' => 'Switzerland', 'sy' => 'Syrian Arab Republic',
'tw' => 'Taiwan', 'tj' => 'Tajikistan', 'tz' => 'Tanzania, United Republic of',
'th' => 'Thailand', 'tl' => 'Timor-Leste', 'tg' => 'Togo',
'tk' => 'Tokelau', 'to' => 'Tonga', 'tt' => 'Trinidad and Tobago',
'tn' => 'Tunisia', 'tr' => 'Turkey', 'tm' => 'Turkmenistan',
'tc' => 'Turks and Caicos Islands', 'tv' => 'Tuvalu', 'ug' => 'Uganda',
'ua' => 'Ukraine', 'ae' => 'United Arab Emirates', 'gb' => 'United Kingdom',
'us' => 'United States', 'um' => 'United States Minor Outlying Islands', 'uy' => 'Uruguay',
'uz' => 'Uzbekistan', 'vu' => 'Vanuatu', 've' => 'Venezuela',
'vn' => 'Viet Nam', 'vg' => 'Virgin Islands, British', 'vi' => 'Virgin Islands, U.S.',
'wf' => 'Wallis and Futuna', 'eh' => 'Western Sahara', 'ye' => 'Yemen',
'zm' => 'Zambia', 'zw' => 'Zimbabwe',
);
return $flags;
}

  ]]>
  </add>
  </operation>
  </file>


Not sure if that gives you any ideas, I might be able to figure it out but would take me several hours of trying different things  :uglystupid2:
Title: Re: Roster Page
Post by: jacortina on October 19, 2007, 02:32:25 AM
OK. Looks like it adds a function to the Subs.php file.

Give this a try (it uses TimUSA's rankorder list, so replace with your own):
global $db_prefix, $scripturl, $txt, $settings, $options;


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  'Administrator',
  'Vice Commodore',
  'Fleet Captain',
  'Board Member',
  'Racing Fleet Member',
);

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
  );
}
mysql_free_result($query);

$flags = CountryFlag();

foreach ($rankorder as $rank)
{
//Now get all the users
   $query2 = db_query("
    SELECT mem.ID_GROUP, mem.ID_MEMBER, mem.realName, mem.usertitle,
          mem.emailAddress, mem.hideEmail, mem.lastLogin, mem.location, mem.personaltext,
          mem.totalTimeLoggedIn, mem.dateRegistered, mem.ICQ, mem.AIM,
          mem.YIM, mem.MSN, thm.value as sail, thm2.value as country
   FROM {$db_prefix}members AS mem
          LEFT JOIN {$db_prefix}themes AS thm ON (thm.ID_MEMBER = mem.ID_MEMBER AND thm.ID_THEME = 1 AND thm.variable = 'sail')
          LEFT JOIN {$db_prefix}themes AS thm2 ON (thm2.ID_MEMBER = mem.ID_MEMBER AND thm2.ID_THEME = 1 AND thm2.variable = 'country')
       WHERE mem.ID_GROUP = " . $groups[$rank]['id'] . "
   ORDER BY mem.realName", __FILE__, __LINE__);
  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="1" align="center" class="bordercolor">
      <tr><td colspan="0" class="catbg"><font size="2" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="100" width="10" class="profilebg" valign="top">
</td>';
      echo '<td class="catinfo" width="270"><b>MEMBER NAME</b></td>';
      echo '<td class="catinfo" width="130"><b>SAIL NUMBER</b></td>';
      echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="100"><b>LOCATION</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="20"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="2" face="verdana">' . $row2['realName'] . '</b>';
echo '</font></font></a><br><font size="1"> ' . $row2['personaltext'] . '</font></a></td><td class="windowbg">' . $row2['sail'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '</font></font></a><br><font size="2"> ' . '<img src="'.$settings['default_images_url'].'/flags/'.$row2['country'].'.png" alt="' . $flags[$row2['country']] . '" />';
        echo '</td><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> ';

//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><br>';
  }
}
Title: Re: Roster Page
Post by: Hairy on October 19, 2007, 02:48:47 AM
Awesome, works like a charm! :D

Thankyou!
Title: Re: Roster Page
Post by: TimUSA on October 30, 2007, 03:41:34 PM
hmm seems to be a problem. when viewing my code in firefox everything appears ok. when in ie7 the tables are all messed up any ideas?

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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  'Administrator',
  'Vice Commodore',
  'Fleet Captain',
  'Board Member',
  'Racing Fleet Member',
);

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
   $query2 = db_query("
    SELECT mem.ID_GROUP, mem.ID_MEMBER, mem.realName, mem.usertitle,
          mem.emailAddress, mem.hideEmail, mem.lastLogin, mem.location, mem.personaltext,
          mem.totalTimeLoggedIn, mem.dateRegistered, mem.ICQ, mem.AIM,
          mem.YIM, mem.MSN, thm.value as sail, thm2.value as country
   FROM {$db_prefix}members AS mem
          LEFT JOIN {$db_prefix}themes AS thm ON (thm.ID_MEMBER = mem.ID_MEMBER AND thm.ID_THEME = 1 AND thm.variable = 'sail')
          LEFT JOIN {$db_prefix}themes AS thm2 ON (thm2.ID_MEMBER = mem.ID_MEMBER AND thm2.ID_THEME = 1 AND thm2.variable = 'country')
       WHERE mem.ID_GROUP = " . $groups[$rank]['id'] . "
   ORDER BY mem.realName", __FILE__, __LINE__);
  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="1" align="center" class="bordercolor">
      <tr><td colspan="0" class="catbg"><font size="2" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="100" width="10" class="profilebg" valign="top">
</td>';
      echo '<td class="catinfo" width="270"><b>MEMBER NAME</b></td>';
      echo '<td class="catinfo" width="130"><b>SAIL NUMBER</b></td>';
      echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="100"><b>LOCATION</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="20"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="2" face="verdana">' . $row2['realName'] . '</b>';
echo '</font></font></a><br><font size="1"> ' . $row2['personaltext'] . '</font></a></td><td class="windowbg">' . $row2['sail'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '</font></font></a><br><font size="2"> ' . '<img src="'.$settings['default_images_url'].'/flags/'.$row2['country'].'.png" />';
        echo '</td><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> ';

//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><br>';
  }
}
Title: Re: Roster Page
Post by: jacortina on October 30, 2007, 05:26:20 PM
You could try finding:
      <tr><td colspan="0" class="catbg"><font size="2" face="verdana"><b>' . $rank . '</b></font></td></tr>

And replacing with:
      <tr><td colspan="6" class="catbg"><font size="2" face="verdana"><b>' . $rank . '</b></font></td></tr>
Title: Re: Roster Page
Post by: TimUSA on October 30, 2007, 05:33:54 PM
duh....thanks
Title: Re: Roster Page
Post by: iGate on December 04, 2007, 02:37:30 AM
Quote from: iGate on September 20, 2007, 02:12:56 PM
is there a way i can add a contrained sized avatar to my roster?.

http://test.ihf.lp.pl/forums/index.php?page=11
i want to use this script:


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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  '=IHF= Administrator',
  '=IHF= Forum Global Moderator',
  '=IHF= Forum Moderator',
  '=IHF= Clan Member',
  '=IHF=[r] Clan Recruit',
  );

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $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 = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="270"><b>Name</b></td>';
      echo '<td class="catinfo" width="130"><b>Avatar</b></td>';
      echo '<td class="catinfo" width="170"><b>Last Online</b></td>';
      echo '<td class="catinfo" width="100"><b>Location</b></td>';
      echo '<td class="catinfo" width="175"><b>Contact</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b>';

echo '</font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . '<img src="'.$settings['default_images_url'].'/avatar/'.$row2['avatar'].'.png" />';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '<i>' . $row2['location'] . '</i>';
        echo '</td><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> ';

//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><br>';
  }
}


any ideas?
Title: Re: Roster Page
Post by: iGate on December 14, 2007, 08:29:29 AM
any1?
Title: Re: Roster Page
Post by: jacortina on December 14, 2007, 03:08:44 PM
There's nothing currently in that code to get the avatar information (which CAN be a pointer to a standard avatar OR an uploaded avatar - which is stored like an attachment - OR can be a link to an offsite pic.

Once you get that, you can add a column to the table and specify height or width for the image (unfortunately, if you specify both, the graphic will be exactly sized to that without respect to original aspect ratio; if you supply just one, the ratio is maintained - at least in FF and IE). This SHOULD be possible through the 'max-width' and/or 'max-height' parameters, but SOME browsers (*cough* IE *cough*) aren't compliant with the standard.
Title: Re: Roster Page
Post by: Dragooon on December 14, 2007, 03:11:43 PM
You simply can do a simple if command in matter of height/width here.
if($row['height'] > xx)
$avatar_height = 150;
else
$avatar_height = $row['height'];

Same with width.
Title: Re: Roster Page
Post by: jacortina on December 14, 2007, 03:18:23 PM
And if the actual graphic for the avatar is 300X200 and the space you're allowing for it is 150X150?

You should first check to see which dimension has to be shrunk by the greatest ratio and then apply that ratio to each of the dimensions or you're going to distort the graphic.
Title: Re: Roster Page
Post by: Dragooon on December 14, 2007, 03:33:48 PM
Actually yeah, never realized that way.
Title: Re: Roster Page
Post by: jacortina on December 14, 2007, 04:50:19 PM
And it kinda requires you to KNOW the avatar's dimensions ;)

Seeing how the code posted shows that 130 pixels are allowed for the avatar column width, supplying a width to the image of 130 (or a centered 126 for a small margin) and leaving out a height specification, will have the browser resize the image in the correct ratio. Yes, the 'taller' pics will demand a greater row height. But it avoids the processing overhead of accessing the graphics library functions.

But, still, the first thing is to get the avatar. And that doesn't HAVE to be in the avatar field of the members table.

The query needs to be changed to:
//Now get all the users
  $query2 = db_query("
     SELECT mem.ID_GROUP, mem.ID_MEMBER, mem.realName, mem.avatar, mem.usertitle,
           mem.emailAddress, mem.hideEmail, mem.lastLogin, mem.location, mem.personalText,
           mem.totalTimeLoggedIn, mem.dateRegistered, mem.ICQ, mem.AIM, mem.YIM, mem.MSN,
           mem.hideEmail, mem.emailAddress, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType
    FROM ({$db_prefix}members AS mem)
    LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
    WHERE ID_GROUP = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);


Then construct the "< img   ... >" specification referring to whichever of the locations the picture is actually located in (I arbitrarily chose 128 as the width to use):
global modSettings;  // add this up top - just a note that it's needed
$av_width = 128;
$avatar_image = ($row2['avatar'] == '' ? ($row2['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row2['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row2['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row2['filename']) . '" alt="" style="width:'.$av_width.';" border="0" />' : '') : (stristr($row2['avatar'], 'http://') ? '<img src="' . $row2['avatar'] . '" alt="" style="width:'.$av_width.';" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row2['avatar']) . '" alt="" style="width:'.$av_width.';" border="0" />'));


That should go after:
      while ($row2 = mysql_fetch_assoc($query2))
      {


Then, find (at end of line - this isn't full line):
<td class="windowbg2">' . '<img src="'.$settings['default_images_url'].'/avatar/'.$row2['avatar'].'.png" />';

Replace with:
<td class="windowbg2">' . $avatar_image;
Title: Re: Roster Page
Post by: iGate on December 15, 2007, 10:59:04 AM
every avatar must be within 65 x 65 pixels. so i should have no trouble with ratios as every avatar is within these constrains.

thx for the code above..trying it out now.



Edit:
didn't work
Title: Re: Roster Page
Post by: jacortina on December 16, 2007, 12:13:37 AM
Quote from: iGate on December 15, 2007, 10:59:04 AM
Edit:
didn't work

Well, I need more than that if you want help. Avatars not showing up? Sizing not working? What?

Can you post your code WITH the changes given?
Title: Re: Roster Page
Post by: iGate on December 16, 2007, 02:29:59 AM
sry i apologise. i should have realised u would need more than that. sry.

http://ihf.lp.pl/index.php?page=27

the error:

Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in /srv/4016/www/Sources/Load.php(1735) : eval()'d code(209) : eval()'d code on line 53


the script.

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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  '=IHF= Administrator',
  '=IHF= Forum Global Moderator',
  '=IHF= Forum Moderator',
  '=IHF= Clan Member',
  '=IHF=[r] Clan Recruit',
  );

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $query2 = db_query("
     SELECT mem.ID_GROUP, mem.ID_MEMBER, mem.realName, mem.avatar, mem.usertitle,
           mem.emailAddress, mem.hideEmail, mem.lastLogin, mem.location, mem.personalText,
           mem.totalTimeLoggedIn, mem.dateRegistered, mem.ICQ, mem.AIM, mem.YIM, mem.MSN,
           mem.hideEmail, mem.emailAddress, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType
    FROM ({$db_prefix}members AS mem)
    LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
    WHERE ID_GROUP = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);
  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="270"><b>Name</b></td>';
      echo '<td class="catinfo" width="130"><b>Avatar</b></td>';
      echo '<td class="catinfo" width="170"><b>Last Online</b></td>';
      echo '<td class="catinfo" width="100"><b>Location</b></td>';
      echo '<td class="catinfo" width="175"><b>Contact</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
global modSettings;  // add this up top - just a note that it's needed
$av_width = 128;
$avatar_image = ($row2['avatar'] == '' ? ($row2['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row2['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row2['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row2['filename']) . '" alt="" style="width:'.$av_width.';" border="0" />' : '') : (stristr($row2['avatar'], 'http://') ? '<img src="' . $row2['avatar'] . '" alt="" style="width:'.$av_width.';" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row2['avatar']) . '" alt="" style="width:'.$av_width.';" border="0" />'));
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b>';

echo '</font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . $avatar_image;
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '<i>' . $row2['location'] . '</i>';
        echo '</td><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> ';

//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><br>';
  }
}


thx for ur help so far, and again sry i forgot to post those details...foolish on my part.
Title: Re: Roster Page
Post by: iGate on December 16, 2007, 02:33:30 AM
i think it was the last step of ur instruction that i went wrong.

sry for dp.
Title: Re: Roster Page
Post by: jacortina on December 16, 2007, 03:45:24 AM
Nope. My error.

This line:
global modSettings;  // add this up top - just a note that it's needed

That should be "$modSettings" (with the "$").

I corrected it and moved it to the top of the script as noted. Try this:
global $db_prefix, $scripturl, $txt, $settings, $options;
global $modSettings;


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  '=IHF= Administrator',
  '=IHF= Forum Global Moderator',
  '=IHF= Forum Moderator',
  '=IHF= Clan Member',
  '=IHF=[r] Clan Recruit',
  );

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $query2 = db_query("
     SELECT mem.ID_GROUP, mem.ID_MEMBER, mem.realName, mem.avatar, mem.usertitle,
           mem.emailAddress, mem.hideEmail, mem.lastLogin, mem.location, mem.personalText,
           mem.totalTimeLoggedIn, mem.dateRegistered, mem.ICQ, mem.AIM, mem.YIM, mem.MSN,
           mem.hideEmail, mem.emailAddress, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType
    FROM ({$db_prefix}members AS mem)
    LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
    WHERE ID_GROUP = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);
  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="270"><b>Name</b></td>';
      echo '<td class="catinfo" width="130"><b>Avatar</b></td>';
      echo '<td class="catinfo" width="170"><b>Last Online</b></td>';
      echo '<td class="catinfo" width="100"><b>Location</b></td>';
      echo '<td class="catinfo" width="175"><b>Contact</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
$av_width = 65;
$avatar_image = ($row2['avatar'] == '' ? ($row2['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row2['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row2['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row2['filename']) . '" alt="" style="width:'.$av_width.';" border="0" />' : '') : (stristr($row2['avatar'], 'http://') ? '<img src="' . $row2['avatar'] . '" alt="" style="width:'.$av_width.';" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row2['avatar']) . '" alt="" style="width:'.$av_width.';" border="0" />'));
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b>';

echo '</font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . $avatar_image;
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '<i>' . $row2['location'] . '</i>';
        echo '</td><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> ';

//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><br>';
  }
}
Title: Re: Roster Page
Post by: iGate on December 16, 2007, 08:08:55 AM
thx the above code worked.

How do i constrain the images sizes?

i tried changing the value $av_width but i still end up with one avatar (mine lol) which is 100px instead of the maximum 65. If it helps i am admin on the forum i am using this script so perhaps its voiding that function for admin users. i cannot test this theory because my co admin does not use an avatar. But it still seems an unreasonable idea.

http://ihf.lp.pl/index.php?page=27

thx so far
Title: Re: Roster Page
Post by: jacortina on December 17, 2007, 01:40:03 AM


Try changing this line:
$avatar_image = ($row2['avatar'] == '' ? ($row2['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row2['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row2['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row2['filename']) . '" alt="" style="width:'.$av_width.';" border="0" />' : '') : (stristr($row2['avatar'], 'http://') ? '<img src="' . $row2['avatar'] . '" alt="" style="width:'.$av_width.';" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row2['avatar']) . '" alt="" style="width:'.$av_width.';" border="0" />'));

To:
$avatar_image = ($row2['avatar'] == '' ? ($row2['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row2['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row2['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row2['filename']) . '" alt="" style="width:'.$av_width.'px;" border="0" />' : '') : (stristr($row2['avatar'], 'http://') ? '<img src="' . $row2['avatar'] . '" alt="" style="width:'.$av_width.'px;" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row2['avatar']) . '" alt="" style="width:'.$av_width.'px;" border="0" />'));

The units ("px") were left out. Firefox assumed that and displayed uniformly sized, smaller pics. IE didn't and it may be because no unit was supplied.
Title: Re: Roster Page
Post by: iGate on December 17, 2007, 11:00:17 AM
thx. that worked
Title: Re: Roster Page
Post by: killerchicken on December 23, 2007, 11:45:07 PM
hi guys i like this mod alot however the link on the first page for the final build does not work anymore any ideas on that?
if someone could post the latest/ Full build here?

Sorry if im being cheeky
Title: Re: Roster Page
Post by: Hairy on December 24, 2007, 12:07:35 AM

There's about a 10 different versions in here now, you'll need to read through the whole thread to find the one you want (we all had to do that also)  :coolsmiley:

^-^
Title: Re: Roster Page
Post by: whiskey on January 04, 2008, 05:05:03 PM
Quote from: londonhogfan on May 31, 2006, 06:56:37 PM
===========================================================================
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.

I know that this is a very old topic but this link is dead, any help on that ?

thanks
Title: Re: Roster Page
Post by: jacortina on January 04, 2008, 06:30:17 PM
Take out 'smf/' to make it:

http://www.tinyportal.net/index.php?topic=5423.msg63479#msg63479
Title: Re: Roster Page
Post by: whiskey on January 04, 2008, 10:24:38 PM
Quote from: J.A.Cortina on January 04, 2008, 06:30:17 PM
Take out 'smf/' to make it:

http://www.tinyportal.net/index.php?topic=5423.msg63479#msg63479

thanks a lot mate
Title: Re: Roster Page
Post by: anX on February 18, 2008, 08:16:03 PM
Is there a way to make a black for this, as in shows the players, avatar  but resized to 40x60px and have the image link to their profile.
Title: Re: Roster Page
Post by: BD.shumar on March 16, 2008, 10:14:31 PM
I need little help, if someone can help me. :)
I have some values in DB, for some members, that I need to show on roster page.
Members are selected with secondary groups.
I know where in DB is value that I need to display on roster page, but I don't know how to make PHP to show that value.

Table: smf_themes
variable: CP4
value: ****

I need to show value on page.

Thank you.
Title: Re: Roster Page
Post by: BD.shumar on March 16, 2008, 11:23:38 PM
I found how to "extract" value that I need.

SELECT value
FROM smf_themes
WHERE variable = 'CP4'


How to add that to roster page ?
I need only username and that value on page...
Title: Re: Roster Page
Post by: JPDeni on March 17, 2008, 12:02:56 AM

  global $db_prefix;
  $query = db_query("SELECT realName, value, th.ID_MEMBER
                     FROM {$db_prefix}themes as th,{$db_prefix}members as mem
                     WHERE variable LIKE 'CP4'
                         AND th.ID_MEMBER = mem.ID_MEMBER
                     ORDER BY realName", __FILE__, __LINE__);
  while ($row = mysql_fetch_assoc($query))
  {
    echo $row['realName'] . ' ' . $row['CP4'] . '<br />';


This is quite similar to the List Mod topic (http://www.tinyportal.net/index.php?topic=22373).
Title: Re: Roster Page
Post by: BD.shumar on March 17, 2008, 12:26:28 AM
I make mistake when I tried to explain what I need. :(
I need this:
global $txt, $scripturl, $user_info, $context, $modSettings, $ID_MEMBER, $board_info, $settings, $db_prefix;

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(13, 12,);
////////////////////////////////////////

$list_by_group = true;         // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups = true;   // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups = false;      // 'true' to include post-count based group in membership search
$include_moderators = false;      // 'true' to include board moderators on page
$repeats_allowed = false;      // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by = 'name';          // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type = 'none';         // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links['3'] = '5';
$extra_links['2'] = '11';

$extra_label_prefix = 'Page of ';   // text to precede member's name in link label for extra link
$extra_label_suffix = '';      // text to append to member's name in link label for extra link

$page_title = 'Hall of Fame';
$page_subtitle = 'Clanovi grupe na koje smo posebno ponosni';

$moderator_group = 3;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord = 'mem.ID_MEMBER ASC';
if ($sort_by == 'posts') $sort_ord = 'mem.posts DESC';
if ($sort_by == 'name') $sort_ord = 'mem.realName ASC';

if (($extra_type != 'board') && ($extra_type != 'page')) $extra_type = 'none';

if ($include_moderators)
   {if (!in_array($moderator_group, $groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if ($list_by_group)
   {$groups_to_use = $groups_list;}
else
   {$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo '<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
   <td colspan="4"><h2 align="center">', $page_title, '</h2>
   <span class="smalltext"><h3 align="center">', $page_subtitle, '</h3></span>
</td></tr>';

if (!$list_by_group)
   echo '<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
      <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2> </h2>
      </td></tr>';

foreach($groups_to_use as $groupnumber)
{
   $loaded_ids = array();
   $user_profile=array();
   $memberContext=array();
   $profile=array();
   $context['TPortal']['team']=array();
 
   // get the name of the group
   $request = db_query("
      SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
   if(mysql_num_rows($request)>0){
      $row = mysql_fetch_row($request);
      $groupNameX=$row[0];
      mysql_free_result($request);
   }

   if ($list_by_group) {
      $select_where = 'mem.ID_GROUP = '.$groupnumber;
      if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
      if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
      if ($include_moderators && ($groupnumber == $moderator_group)) $select_where = 'mem.ID_MEMBER = m.ID_MEMBER';
   }
   else {
      $select_where = 'mem.ID_GROUP IN (' . implode(', ', $groups_list) . ')';
      if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
      if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP IN (' . implode(', ', $groups_list) . ')';
      if ($include_moderators) $select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
   }

   $select_where = '(' . $select_where . ') AND mem.ID_MEMBER NOT IN (' . implode(', ', $users_already_listed) . ')';

   // Load the member's data.
   $request = db_query("
      SELECT   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 as memnum, mem.memberName, mem.ID_GROUP,
         mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
         mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName
      FROM ({$db_prefix}members AS mem)
         LEFT JOIN {$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
         LEFT JOIN {$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
         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)
      WHERE $select_where
      GROUP BY mem.ID_MEMBER
      ORDER BY $sort_ord", __FILE__, __LINE__);
   $new_loaded_ids = array();
   $member_count = 0;

   while ($row = mysql_fetch_assoc($request))
   {
      if (!$repeats_allowed) $users_already_listed[$row['memnum']] = $row['memnum'];

      $member_count += 1;

      $avatar_width = '';
      $avatar_height = '';
      if($context['browser']['is_ie6']) $avatar_width = 'width="' . $modSettings['avatar_max_width_external'] . '"';

      $context['TPortal']['team'][] = array(
         'username' => $row['memberName'],
         'usertitle' => $row['usertitle'],
         'name' => $row['realName'],
         'comment' => $row['comment'],
         'groupname' => ($groupnum == 0) ? $row['groupName'] : $groupNameX ,
         'posts' => $row['posts'],
         'karmabad' => $row['karmaBad'],
         'karmagood' => $row['karmaGood'],
         'location' => $row['location'],
         'href' => $scripturl . '?action=profile;u=' . $row['memnum'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['memnum'] . '" 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="" style="max-height:280px;max-width:180px;" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" style="max-height:280px;max-width:180px;" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" 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'],
         'member_page' => ($extra_type == 'none') ? '' : empty($extra_links[$row['memnum']]) ? '' : $extra_links[$row['memnum']],
      );

   }
   mysql_free_result($request);

   if ($member_count > 0)
   {
      if ($list_by_group)
      echo '<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
         <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2 align="center">' . $groupNameX . '</h2>
         </td></tr>';

      echo '<tr>';
           $newrow=0;

      foreach($context['TPortal']['team'] as $team)
           {
         echo '
            <td valign="top" width="18%">'.$team['avatar']['image'].'</td>';

         echo '   <td valign="top" class="middletext" style="padding: 2px;">';

            echo '<h2 style="margin-top: 0; margin-bottom: 4px;">'.$team['link'].'</h2>';

            echo ''. $team['usertitle'].'
';

            echo ''. $team['comment'].'
';

            if (!$list_by_group)
               echo ''.$txt[87].': '.$team['groupname'].'
';

            if ($modSettings['karmaMode'] == '1')
               echo '', $modSettings['karmaLabel'], ' ', $team['karmagood'] - $team['karmabad'], '
';
            elseif ($modSettings['karmaMode'] == '2')
               echo '', $modSettings['karmaLabel'], ' +', $team['karmagood'], ' | -', $team['karmabad'], '
';

            echo ''.$txt['lastLoggedIn'].': '.$team['last_login'].'
';



            echo !empty($team['location']) ? ''.$txt[227].': '.$team['location'].'
' : '';

            echo !empty($team['website']['title']) ? ''.$txt[96].': <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a>
' : '';


            echo !empty($team['blurb']) ? '- '.$team['blurb'].'
' : '';

            echo !empty($team['teamtext']) ? $team['teamtext'].'
' : '';

            if (($extra_type == 'board') && !empty($team['member_page']))
               echo '<a href="' . $scripturl . '?board=' . $team['member_page'] . '">'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</a>
';
            if (($extra_type == 'page') && !empty($team['member_page']))
               echo '<a href="' . $scripturl . '?page=' . $team['member_page'] . '">'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</a>
';

         echo '
            </td>';

         $newrow++;
         if($newrow>1){
            $newrow=0;
            echo '</tr><tr><td colspan="4"></td></tr><tr>';
         }
           }
      if($newrow=1) echo '<td colspan="2"></td>';
      echo '</tr>';
   }

}
echo '</table>';

but without "lastloggedin" and with value from CP4 field.
Sorry for making mistake. It's almost 2AM here.

Thank you.
Title: Re: Roster Page
Post by: JPDeni on March 17, 2008, 03:06:06 PM
Can you do without the "teamtext" value? If so, do a search-and-replace on the code, replacing teamtext with CP4.

If not, I don't know how to do it.
Title: Re: Roster Page
Post by: BD.shumar on March 17, 2008, 08:27:59 PM
It's work.
Thank you.
Title: Re: Roster Page
Post by: BD.shumar on March 17, 2008, 09:32:08 PM
But now I have a different problem...
I get a LOT of errors in my log file.
All errors are have 2 similarities:

8: Undefined offset: 0

Line: 762

Problem is that file is different every time...

Maybe this is starter of problem:
Undefined variable: groupnum
Title: Re: Roster Page
Post by: JPDeni on March 17, 2008, 09:38:47 PM
Try changing


'groupname' => ($groupnum == 0) ? $row['groupName'] : $groupNameX ,


to



'groupname' => ($groupnumber == 0) ? $row['groupName'] : $groupNameX ,
Title: Re: Roster Page
Post by: BD.shumar on March 17, 2008, 09:53:25 PM
hm...
Still get errors...

8: Undefined offset: 0
File: /htdocs/Themes/default/Display.template.php (eval?)
Line: 762

8: Undefined offset: 0
File: /htdocs/Themes/default/TPortal.template.php (eval?)
Line: 762

....
etc...
Title: Re: Roster Page
Post by: JPDeni on March 17, 2008, 10:03:43 PM
I don't know what the problem is. Are you sure that it only occurs when you use this script?
Title: Re: Roster Page
Post by: BD.shumar on March 17, 2008, 10:09:23 PM
I found where is problem. :)
index.template.php
Quote//Hall of fame menu button
if ($context[$current_action == 'halloffame'])
      $current_action = 'halloffame';
      echo ($current_action=='halloffame' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
            <td valign="top" class="maintab_' , $current_action == 'halloffame' ? 'active_back' : 'back' , '">
               <a href="./hall_of_fame-p9.html">Hall of Fame</a>
            </td>' , $current_action == 'halloffame' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

Bold is in line 762...

how to make a button in menu to call this article ??
Title: Re: Roster Page
Post by: IchBin on March 17, 2008, 10:36:11 PM
I do believe I answered your question about this at SMF.
Title: Re: Roster Page
Post by: BD.shumar on March 18, 2008, 12:01:27 AM
hm...
I saw that and make some changes but problem is changed too. :)
Title: Re: Roster Page
Post by: JPDeni on March 18, 2008, 12:14:05 AM
It really would help if you would stick to one place to find answers to your problems. It's difficult for those who want to help you to know what is said elsewhere. If you come to the point where you think we can't help you here, tell us that you're going somewhere else so we don't continue to work on your problem.
Title: Re: Roster Page
Post by: trench on March 21, 2008, 12:50:57 AM
Wheres the final coding for this? I tried clicking the link in the first page and was sent to an error page.
Title: Re: Roster Page
Post by: JPDeni on March 21, 2008, 12:57:50 AM

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

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(1);
////////////////////////////////////////

$list_by_group = true;         // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups = true;   // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups = false;      // 'true' to include post-count based group in membership search
$include_moderators = false;      // 'true' to include board moderators on page
$repeats_allowed = false;      // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by = 'name';          // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type = 'none';         // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links['3'] = '5';
$extra_links['2'] = '11';

$extra_label_prefix = 'Page of ';   // text to precede member's name in link label for extra link
$extra_label_suffix = '';      // text to append to member's name in link label for extra link

$page_title = 'Roster';
$page_subtitle = '';

$moderator_group = 3;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord = 'mem.ID_MEMBER ASC';
if ($sort_by == 'posts') $sort_ord = 'mem.posts DESC';
if ($sort_by == 'name') $sort_ord = 'mem.realName ASC';

if (($extra_type != 'board') && ($extra_type != 'page')) $extra_type = 'none';

if ($include_moderators)
   {if (!in_array($moderator_group, $groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if ($list_by_group)
   {$groups_to_use = $groups_list;}
else
   {$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo '<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
   <td colspan="4"><h2 align="center">', $page_title, '</h2>
   <span class="smalltext"><h3 align="center">', $page_subtitle, '</h3></span>
</td></tr>';

if (!$list_by_group)
   echo '<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
      <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2> </h2>
      </td></tr>';

foreach($groups_to_use as $groupnumber)
{
   $loaded_ids = array();
   $user_profile=array();
   $memberContext=array();
   $profile=array();
   $context['TPortal']['team']=array();
 
   // get the name of the group
   $request = db_query("
      SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
   if(mysql_num_rows($request)>0){
      $row = mysql_fetch_row($request);
      $groupNameX=$row[0];
      mysql_free_result($request);
   }

   if ($list_by_group) {
      $select_where = 'mem.ID_GROUP = '.$groupnumber;
      if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
      if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
      if ($include_moderators && ($groupnumber == $moderator_group)) $select_where = 'mem.ID_MEMBER = m.ID_MEMBER';
   }
   else {
      $select_where = 'mem.ID_GROUP IN (' . implode(', ', $groups_list) . ')';
      if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
      if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP IN (' . implode(', ', $groups_list) . ')';
      if ($include_moderators) $select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
   }

   $select_where = '(' . $select_where . ') AND mem.ID_MEMBER NOT IN (' . implode(', ', $users_already_listed) . ')';

   // Load the member's data.
   $request = db_query("
      SELECT   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 as memnum, mem.memberName, mem.ID_GROUP,
         mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
         mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName
      FROM ({$db_prefix}members AS mem)
         LEFT JOIN {$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
         LEFT JOIN {$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
         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)
      WHERE $select_where
      GROUP BY mem.ID_MEMBER
      ORDER BY $sort_ord", __FILE__, __LINE__);
   $new_loaded_ids = array();
   $member_count = 0;

   while ($row = mysql_fetch_assoc($request))
   {
      if (!$repeats_allowed) $users_already_listed[$row['memnum']] = $row['memnum'];

      $member_count += 1;

      $avatar_width = '';
      $avatar_height = '';
      if($context['browser']['is_ie6']) $avatar_width = 'width="' . $modSettings['avatar_max_width_external'] . '"';

      $context['TPortal']['team'][] = array(
         'username' => $row['memberName'],
         'usertitle' => $row['usertitle'],
         'name' => $row['realName'],
         'comment' => $row['comment'],
         'groupname' => ($groupnum == 0) ? $row['groupName'] : $groupNameX ,
         'posts' => $row['posts'],
         'karmabad' => $row['karmaBad'],
         'karmagood' => $row['karmaGood'],
         'location' => $row['location'],
         'href' => $scripturl . '?action=profile;u=' . $row['memnum'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['memnum'] . '" 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="" style="max-height:280px;max-width:180px;" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" style="max-height:280px;max-width:180px;" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" 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'],
         'member_page' => ($extra_type == 'none') ? '' : empty($extra_links[$row['memnum']]) ? '' : $extra_links[$row['memnum']],
      );

   }
   mysql_free_result($request);

   if ($member_count > 0)
   {
      if ($list_by_group)
      echo '<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
         <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2 align="center">' . $groupNameX . '</h2>
         </td></tr>';

      echo '<tr>';
           $newrow=0;

      foreach($context['TPortal']['team'] as $team)
           {
         echo '
            <td valign="top" width="18%">'.$team['avatar']['image'].'</td>';

         echo '   <td valign="top" class="middletext" style="padding: 2px;">';

            echo '<h2 style="margin-top: 0; margin-bottom: 4px;">'.$team['link'].'</h2>';

            echo ''. $team['usertitle'].'
';

            echo ''. $team['comment'].'
';

            if (!$list_by_group)
               echo ''.$txt[87].': '.$team['groupname'].'
';

            if ($modSettings['karmaMode'] == '1')
               echo '', $modSettings['karmaLabel'], ' ', $team['karmagood'] - $team['karmabad'], '
';
            elseif ($modSettings['karmaMode'] == '2')
               echo '', $modSettings['karmaLabel'], ' +', $team['karmagood'], ' | -', $team['karmabad'], '
';

            echo ''.$txt['lastLoggedIn'].': '.$team['last_login'].'
';



            echo !empty($team['location']) ? ''.$txt[227].': '.$team['location'].'
' : '';

            echo !empty($team['website']['title']) ? ''.$txt[96].': <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a>
' : '';


            echo !empty($team['blurb']) ? '- '.$team['blurb'].'
' : '';

            echo !empty($team['teamtext']) ? $team['teamtext'].'
' : '';

            if (($extra_type == 'board') && !empty($team['member_page']))
               echo '<a href="' . $scripturl . '?board=' . $team['member_page'] . '">'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</a>
';
            if (($extra_type == 'page') && !empty($team['member_page']))
               echo '<a href="' . $scripturl . '?page=' . $team['member_page'] . '">'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</a>
';

         echo '
            </td>';

         $newrow++;
         if($newrow>1){
            $newrow=0;
            echo '</tr><tr><td colspan="4"></td></tr><tr>';
         }
           }
      if($newrow=1) echo '<td colspan="2"></td>';
      echo '</tr>';
   }

}
echo '</table>';
Title: Re: Roster Page
Post by: trench on March 21, 2008, 12:59:25 AM
Thanks JP! Fabulous! I LOVE YOU!
Title: Re: Roster Page
Post by: trench on March 21, 2008, 01:03:30 AM
How come it doesn't look like this in tables?

http://www.the-rota.com/?page=30
Title: Re: Roster Page
Post by: IchBin on March 21, 2008, 01:27:25 AM
Probably because the rota site has customized it.
Title: Re: Roster Page
Post by: trench on March 21, 2008, 02:26:16 AM
cheers! I got it working nicely!
Title: Re: Roster Page
Post by: Plectrum on March 27, 2008, 04:02:08 PM
I'm sort of confused. I don't know PHP at all but i copied the final code put together by JPDeni and put it into a PHP Article. It shows the Administrator group but i don't know how to make it show another group. Can someone explain to me how i make the "Administrator" group and Another group show as well?
Title: Re: Roster Page
Post by: JPDeni on March 27, 2008, 04:13:22 PM
Find the numbers of the groups that you want to include. Let's say you want to include groups 3, 5 and 7, in addition to group 1 (admin).

Look for


$groups_list = array(1);


It's near the top.

Change it to


$groups_list = array(1,3,5,7);


Just put the numbers of the groups you want to include within the parentheses, separated by commas.
Title: Re: Roster Page
Post by: Plectrum on March 27, 2008, 04:16:41 PM
Ah Thanks, But how do you know the number of each group? Like I saw Admin, Then global Modertor, Then Moderator, Then Clan Member. Clan member is my own membergroup. I added "4" after 1 in the code and refreshed the page but nothing changed
Title: Re: Roster Page
Post by: Ken. on March 27, 2008, 04:43:04 PM
In your Admin panel look under "Manage Membergroups" and hover over the group name you want to include... you should then see the membergroup number in the address string in the lower left of your browser window.

EDIT: Using a low number may not return a result because you may not have any members in the group... numbers for groups that you have added tend to be higher, like 10 or 11 or 12 etc.
Title: Re: Roster Page
Post by: Plectrum on March 27, 2008, 04:47:52 PM
YAY!! It worked. Thank you so much JP and Ken!!!
Title: Re: Roster Page
Post by: Kristos on April 06, 2008, 10:19:00 PM
This works out great, but I have a question. I have multiple custom profile fields that I would like to show up in the roster. I'm using the code straight from the page and made no changes to it other then the teamtext which I changed to FN1 which displays a family name. But I have other custom fields that I would also like to add. They are under smf_themes, CP1, FN2, etc.. how would I go about adding those? I tried, but nothing I did worked. My coding is weak at best. :'(

         mem.websiteUrl, mem.location, mem.posts, them.value AS FN1, m.ID_MEMBER as modmem, g.groupName
      FROM ({$db_prefix}members AS mem)
         LEFT JOIN {$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
         LEFT JOIN {$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
         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 = 'FN1' AND them.ID_THEME=1)


FN1 took the spot of teamtext in the code.
Title: Re: Roster Page
Post by: tarmer on April 11, 2008, 01:33:44 PM
Thanks for all the work you guys do... This is great stuff

Question for anyone - this code below works great, What if I am running a fantasy baseball or soccer site  - How can I modify this code to create a "player roster" vs a "member roster"

Do I have to enter each name in as a member - or is there something I can do to enter the names into the DB (lets say Derek Jeter) and get the DB to read from this rather than the memeber ID section ?

Thanks in advance

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

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(1);
////////////////////////////////////////

$list_by_group = true;         // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups = true;   // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups = false;      // 'true' to include post-count based group in membership search
$include_moderators = false;      // 'true' to include board moderators on page
$repeats_allowed = false;      // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by = 'name';          // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type = 'none';         // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links['3'] = '5';
$extra_links['2'] = '11';

$extra_label_prefix = 'Page of ';   // text to precede member's name in link label for extra link
$extra_label_suffix = '';      // text to append to member's name in link label for extra link

$page_title = 'Roster';
$page_subtitle = '';

$moderator_group = 3;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord = 'mem.ID_MEMBER ASC';
if ($sort_by == 'posts') $sort_ord = 'mem.posts DESC';
if ($sort_by == 'name') $sort_ord = 'mem.realName ASC';

if (($extra_type != 'board') && ($extra_type != 'page')) $extra_type = 'none';

if ($include_moderators)
   {if (!in_array($moderator_group, $groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if ($list_by_group)
   {$groups_to_use = $groups_list;}
else
   {$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo '<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
   <td colspan="4"><h2 align="center">', $page_title, '</h2>
   <span class="smalltext"><h3 align="center">', $page_subtitle, '</h3></span>
</td></tr>';

if (!$list_by_group)
   echo '<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
      <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2> </h2>
      </td></tr>';

foreach($groups_to_use as $groupnumber)
{
   $loaded_ids = array();
   $user_profile=array();
   $memberContext=array();
   $profile=array();
   $context['TPortal']['team']=array();
 
   // get the name of the group
   $request = db_query("
      SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
   if(mysql_num_rows($request)>0){
      $row = mysql_fetch_row($request);
      $groupNameX=$row[0];
      mysql_free_result($request);
   }

   if ($list_by_group) {
      $select_where = 'mem.ID_GROUP = '.$groupnumber;
      if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
      if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
      if ($include_moderators && ($groupnumber == $moderator_group)) $select_where = 'mem.ID_MEMBER = m.ID_MEMBER';
   }
   else {
      $select_where = 'mem.ID_GROUP IN (' . implode(', ', $groups_list) . ')';
      if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
      if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP IN (' . implode(', ', $groups_list) . ')';
      if ($include_moderators) $select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
   }

   $select_where = '(' . $select_where . ') AND mem.ID_MEMBER NOT IN (' . implode(', ', $users_already_listed) . ')';

   // Load the member's data.
   $request = db_query("
      SELECT   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 as memnum, mem.memberName, mem.ID_GROUP,
         mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
         mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName
      FROM ({$db_prefix}members AS mem)
         LEFT JOIN {$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
         LEFT JOIN {$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
         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)
      WHERE $select_where
      GROUP BY mem.ID_MEMBER
      ORDER BY $sort_ord", __FILE__, __LINE__);
   $new_loaded_ids = array();
   $member_count = 0;

   while ($row = mysql_fetch_assoc($request))
   {
      if (!$repeats_allowed) $users_already_listed[$row['memnum']] = $row['memnum'];

      $member_count += 1;

      $avatar_width = '';
      $avatar_height = '';
      if($context['browser']['is_ie6']) $avatar_width = 'width="' . $modSettings['avatar_max_width_external'] . '"';

      $context['TPortal']['team'][] = array(
         'username' => $row['memberName'],
         'usertitle' => $row['usertitle'],
         'name' => $row['realName'],
         'comment' => $row['comment'],
         'groupname' => ($groupnum == 0) ? $row['groupName'] : $groupNameX ,
         'posts' => $row['posts'],
         'karmabad' => $row['karmaBad'],
         'karmagood' => $row['karmaGood'],
         'location' => $row['location'],
         'href' => $scripturl . '?action=profile;u=' . $row['memnum'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['memnum'] . '" 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="" style="max-height:280px;max-width:180px;" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" style="max-height:280px;max-width:180px;" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" 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'],
         'member_page' => ($extra_type == 'none') ? '' : empty($extra_links[$row['memnum']]) ? '' : $extra_links[$row['memnum']],
      );

   }
   mysql_free_result($request);

   if ($member_count > 0)
   {
      if ($list_by_group)
      echo '<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
         <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2 align="center">' . $groupNameX . '</h2>
         </td></tr>';

      echo '<tr>';
           $newrow=0;

      foreach($context['TPortal']['team'] as $team)
           {
         echo '
            <td valign="top" width="18%">'.$team['avatar']['image'].'</td>';

         echo '   <td valign="top" class="middletext" style="padding: 2px;">';

            echo '<h2 style="margin-top: 0; margin-bottom: 4px;">'.$team['link'].'</h2>';

            echo ''. $team['usertitle'].'
';

            echo ''. $team['comment'].'
';

            if (!$list_by_group)
               echo ''.$txt[87].': '.$team['groupname'].'
';

            if ($modSettings['karmaMode'] == '1')
               echo '', $modSettings['karmaLabel'], ' ', $team['karmagood'] - $team['karmabad'], '
';
            elseif ($modSettings['karmaMode'] == '2')
               echo '', $modSettings['karmaLabel'], ' +', $team['karmagood'], ' | -', $team['karmabad'], '
';

            echo ''.$txt['lastLoggedIn'].': '.$team['last_login'].'
';



            echo !empty($team['location']) ? ''.$txt[227].': '.$team['location'].'
' : '';

            echo !empty($team['website']['title']) ? ''.$txt[96].': <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a>
' : '';


            echo !empty($team['blurb']) ? '- '.$team['blurb'].'
' : '';

            echo !empty($team['teamtext']) ? $team['teamtext'].'
' : '';

            if (($extra_type == 'board') && !empty($team['member_page']))
               echo '<a href="' . $scripturl . '?board=' . $team['member_page'] . '">'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</a>
';
            if (($extra_type == 'page') && !empty($team['member_page']))
               echo '<a href="' . $scripturl . '?page=' . $team['member_page'] . '">'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</a>
';

         echo '
            </td>';

         $newrow++;
         if($newrow>1){
            $newrow=0;
            echo '</tr><tr><td colspan="4"></td></tr><tr>';
         }
           }
      if($newrow=1) echo '<td colspan="2"></td>';
      echo '</tr>';
   }

}
echo '</table>';
Title: Re: Roster Page
Post by: JPDeni on April 11, 2008, 02:05:07 PM
As it is written, you would have to create member accounts for each of the players.

I don't know exactly how these fantasy sports things work, but I'm pretty sure that this code wouldn't work for it.

I don't know if there are previous topics about this or not. I guess the first thing to do would be to do a search and see what other code has already been written. If you don't find anything, you might want to start a new topic and explain in detail exactly what you want. If it seems to be doable, I might be able to give it a try. 
Title: Re: Roster Page
Post by: tarmer on April 11, 2008, 02:15:11 PM
Thank You......  I will do so
Title: Re: Roster Page
Post by: nutcase82 on April 21, 2008, 07:53:35 PM
IS there any way to take away the avatars?  Also I want to put the member group pictures in the main title for each group.
Title: Re: Roster Page
Post by: nutcase82 on April 21, 2008, 08:04:00 PM
nevermind about the avatars..I just deleted this code

echo '
            <td valign="top" width="18%">'.$team['avatar']['image'].'</td>';

Title: Re: Roster Page
Post by: goberpiles on April 30, 2008, 09:30:01 PM
Hi I am after some help please, I am really new to this and have read for all of the pages here, I have the same sort of question as one of the above.  I have custom profile fields using Custom Profile Field Mod and I would like to include two of these fields in my roster page.  Curently I have this: http://goberpiles.com/smf/index.php?page=7 the two fields I want to show are 1. PSN name and 2. Team name.

PSN is a playstation network name and team name is a team I will assign to players.  Any ideas on how to get the custom profile fields onto the roster?

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


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  'Prem',
  'Championship',
  'League One',
//  'rank 4',
//  'rank 5',
);

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $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 = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="270"><b>NAME</b></td>';
      echo '<td class="catinfo" width="130"><b>PSN</b></td>';
      echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="120"><b>TEAM</b></td>';
      echo '<td class="catinfo" width="165"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b>';

echo '</font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . $row2['usertitle'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '<i>' . $row2['location'] . '</i>';
        echo '</td><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> ';

//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><br>';
  }
}
Title: Re: Roster Page
Post by: DOOM666 on July 07, 2008, 01:08:55 AM
ok im useing JPDeni Roster page i like i but i wont to know i there is a way to show an img instead of the title of the group. the img i have have the title in them.

Thanks,
DOOM666
Title: Re: Roster Page
Post by: JPDeni on July 07, 2008, 01:16:50 AM
Rather than make me go through the whole topic to find the code you're using (which I must have written well over a year ago) could you post it, please, using the [ code ] tags. I don't know how the titles are displayed now, which I would need to know in order to tell you how to change them.
Title: Re: Roster Page
Post by: DOOM666 on July 07, 2008, 01:20:53 AM
here you go sory abou that

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

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(13,14);
////////////////////////////////////////

$list_by_group = true;         // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups = true;   // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups = false;      // 'true' to include post-count based group in membership search
$include_moderators = false;      // 'true' to include board moderators on page
$repeats_allowed = false;      // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by = 'name';          // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type = 'none';         // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links['3'] = '5';
$extra_links['2'] = '11';

$extra_label_prefix = 'Page of ';   // text to precede member's name in link label for extra link
$extra_label_suffix = '';      // text to append to member's name in link label for extra link

$page_title = 'Wu Shu Warriors Roster';
$page_subtitle = '';

$moderator_group = '';
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord = 'mem.ID_MEMBER ASC';
if ($sort_by == 'posts') $sort_ord = 'mem.posts DESC';
if ($sort_by == 'name') $sort_ord = 'mem.realName ASC';

if (($extra_type != 'board') && ($extra_type != 'page')) $extra_type = 'none';

if ($include_moderators)
   {if (!in_array($moderator_group, $groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if ($list_by_group)
   {$groups_to_use = $groups_list;}
else
   {$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo '<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
   <td colspan="4"><h2 align="center">', $page_title, '</h2>
   <span class="smalltext"><h3 align="center">', $page_subtitle, '</h3></span>
</td></tr>';

if (!$list_by_group)
   echo '<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
      <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2> </h2>
      </td></tr>';

foreach($groups_to_use as $groupnumber)
{
   $loaded_ids = array();
   $user_profile=array();
   $memberContext=array();
   $profile=array();
   $context['TPortal']['team']=array();
 
   // get the name of the group
   $request = db_query("
      SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
   if(mysql_num_rows($request)>0){
      $row = mysql_fetch_row($request);
      $groupNameX=$row[0];
      mysql_free_result($request);
   }

   if ($list_by_group) {
      $select_where = 'mem.ID_GROUP = '.$groupnumber;
      if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
      if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
      if ($include_moderators && ($groupnumber == $moderator_group)) $select_where = 'mem.ID_MEMBER = m.ID_MEMBER';
   }
   else {
      $select_where = 'mem.ID_GROUP IN (' . implode(', ', $groups_list) . ')';
      if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
      if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP IN (' . implode(', ', $groups_list) . ')';
      if ($include_moderators) $select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
   }

   $select_where = '(' . $select_where . ') AND mem.ID_MEMBER NOT IN (' . implode(', ', $users_already_listed) . ')';

   // Load the member's data.
   $request = db_query("
      SELECT   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 as memnum, mem.memberName, mem.ID_GROUP,
         mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
         mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName
      FROM ({$db_prefix}members AS mem)
         LEFT JOIN {$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
         LEFT JOIN {$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
         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)
      WHERE $select_where
      GROUP BY mem.ID_MEMBER
      ORDER BY $sort_ord", __FILE__, __LINE__);
   $new_loaded_ids = array();
   $member_count = 0;

   while ($row = mysql_fetch_assoc($request))
   {
      if (!$repeats_allowed) $users_already_listed[$row['memnum']] = $row['memnum'];

      $member_count += 1;

      $avatar_width = '';
      $avatar_height = '';
      if($context['browser']['is_ie6']) $avatar_width = 'width="' . $modSettings['avatar_max_width_external'] . '"';

      $context['TPortal']['team'][] = array(
         'username' => $row['memberName'],
         'usertitle' => $row['usertitle'],
         'name' => $row['realName'],
         'comment' => $row['comment'],
         'groupname' => ($groupnumber == 0) ? $row['groupName'] : $groupNameX ,
         'posts' => $row['posts'],
         'karmabad' => $row['karmaBad'],
         'karmagood' => $row['karmaGood'],
         'location' => $row['location'],
         'href' => $scripturl . '?action=profile;u=' . $row['memnum'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['memnum'] . '" 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="" style="max-height:280px;max-width:180px;" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" style="max-height:280px;max-width:180px;" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" 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'],
         'member_page' => ($extra_type == 'none') ? '' : empty($extra_links[$row['memnum']]) ? '' : $extra_links[$row['memnum']],
      );

   }
   mysql_free_result($request);

   if ($member_count > 0)
   {
      if ($list_by_group)
      echo '<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
         <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2 align="center">' . $groupNameX . '</h2>
         </td></tr>';

      echo '<tr>';
           $newrow=0;

      foreach($context['TPortal']['team'] as $team)
           {
         

         echo '   <td valign="top" class="middletext" style="padding: 2px;">';

            echo '<h2 style="margin-top: 0; margin-bottom: 4px;">'.$team['link'].'</h2>';

            echo ''. $team['usertitle'].'
';

            echo ''. $team['comment'].'
';

            if (!$list_by_group)
               echo ''.$txt[87].': '.$team['groupname'].'
';

            if ($modSettings['karmaMode'] == '1')
               echo '', $modSettings['karmaLabel'], ' ', $team['karmagood'] - $team['karmabad'], '
';
            elseif ($modSettings['karmaMode'] == '2')
               echo '', $modSettings['karmaLabel'], ' +', $team['karmagood'], ' | -', $team['karmabad'], '
';

            echo ''.$txt['lastLoggedIn'].': '.$team['last_login'].'
';



            echo !empty($team['location']) ? ''.$txt[227].': '.$team['location'].'
' : '';

            echo !empty($team['website']['title']) ? ''.$txt[96].': <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a>
' : '';


            echo !empty($team['blurb']) ? '- '.$team['blurb'].'
' : '';

            echo !empty($team['teamtext']) ? $team['teamtext'].'
' : '';

            if (($extra_type == 'board') && !empty($team['member_page']))
               echo '<a href="' . $scripturl . '?board=' . $team['member_page'] . '">'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</a>
';
            if (($extra_type == 'page') && !empty($team['member_page']))
               echo '<a href="' . $scripturl . '?page=' . $team['member_page'] . '">'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</a>
';

         echo '
            </td>';

         $newrow++;
         if($newrow>1){
            $newrow=0;
            echo '</tr><tr><td colspan="4"></td></tr><tr>';
         }
           }
      if($newrow=1) echo '<td colspan="2"></td>';
      echo '</tr>';
   }

}
echo '</table>';
Title: Re: Roster Page
Post by: JPDeni on July 07, 2008, 02:09:22 AM
It looks like the code you'll need to change is in the line


         <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2 align="center">' . $groupNameX . '</h2>


and specifically



<h2 align="center">' . $groupNameX . '</h2>



Probably the easiest way to do it is to define your images at the beginning of the script. Something like:



$group_image['group1'] = $settings['images_url'] . '/imagename1.jpg';
$group_image['group2'] = $settings['images_url'] . '/imagename2.jpg';
$group_image['group3'] = $settings['images_url'] . '/imagename3.jpg';



And so on. Make sure that the "group1" etc. is exactly the same as the groups are named, including capitalization. Put all the images in the images directory in your theme.

Then, change



<h2 align="center">' . $groupNameX . '</h2>



to



<img src="' . $group_image[$groupNameX] . '" />

Title: Re: Roster Page
Post by: DOOM666 on July 07, 2008, 02:21:32 AM
Thanks JP that work. now i have one more ? when i was whating i notice that any time i look a the page the forums creates errors could you help me with that

 
   
http://www.wu-dojo.com/forums/index.php?page=21 
8: Undefined index: 5
File: /home/wudojo/public_html/forums/Themes/default/languages/Profile.english.php (main sub template - eval?)
Line: 158




SMF 1.1.5 TP 1.0.5
Title: Re: Roster Page
Post by: JPDeni on July 07, 2008, 02:24:48 AM
Then take out the code. Maybe someone else will have some ideas. I'm not sure of what I'm doing, really, because this wasn't my code to start with.
Title: Re: Roster Page
Post by: DOOM666 on July 07, 2008, 02:27:55 AM
ok Thanks
Title: Re: Roster Page
Post by: schnups on July 15, 2008, 08:47:57 PM
I have the same problem as most of the Forum users, I want to include a custom profile field into the roster. I use the same code as the original one posted.  I dont need the NAME field so I replaced it with another name and tried to change the code so it will display a custom profile field text instead of the realname.

I changed the "Name" title to "ingame-name" since Im running a gamer community, but please show me how to add a custom profile field

My Code:
global $db_prefix, $scripturl, $txt, $settings, $options;


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  'Nameless',
  'High Admin',
  'Multi Admin',
  'Infection Admin',
  'KreedZ Admin',
  'Knife Arena Admin',
  'StarWars Admin',
  'GunGame Admin',
);


$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $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 = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="270"><b>GAMING ALIAS</b></td>';
      echo '<td class="catinfo" width="130"><b>NAME</b></td>';
      echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="100"><b>LOCATION</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b>';

echo '</font></font></a><br><font size="1"> ' . $row2['personalText'] . '</font></a></td><td class="windowbg2">' . $row2['usertitle'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '<i>' . $row2['location'] . '</i>';
        echo '</td><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> ';

//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><br>';
  }
}
Title: Re: Roster Page
Post by: IchBin on July 15, 2008, 09:19:12 PM
Since we do not have the custom profile fields we cannot possibly show you how to get that field. You should ask the custom profile mod author if you can grab the field some how.
Title: Re: Roster Page
Post by: JPDeni on July 15, 2008, 09:27:39 PM
If you're wanting to add one custom profile field, go to http://www.tinyportal.net/index.php?topic=5423.msg182603#msg182603 and start reading there. The explanation of how to do it is in the next several posts.

If you're wanting to add more than once custom profile field, the whole script would have to be rewritten because of the way custom profile fields are stored in the database.
Title: Re: Roster Page
Post by: megaspeek on September 30, 2008, 01:19:53 PM
how could i password lock some groups? so that anyone can just enter and show up on the list for that rank?
Title: Re: Roster Page
Post by: Deadfire on February 25, 2009, 03:37:36 AM
I have  a question about the roster I'm making How can I make this script select none primary groups as well?


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

echo '
<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
<tr>
<td><a href="http://www.site.net/index.php?page=5&option=rank">Rank</a></td>
<td><a href="http://www.site.net/index.php?page=5&option=position">Position</a></td>
<td><a href="http://www.site.net/index.php?page=5&option=section">Section</a></td>
</tr>
</table>
<br />
';
/* this will decide what to do, if you have stuff common to all three put it above this
   then handle the special stuff in here or call functions to do it. */
if (isset($_REQUEST['option'])) {
switch($_REQUEST['option']) {

case 'rank':
default:

// These must be in the order
$rankorder = array(
'Corporal',
  'Specialist',
  'Private First Class',
  'Private E-2',
'Private E-1',
);

break;

case 'position':


// These must be in the order
$rankorder = array(
'Headquarters',
  'Alpha Squad',
  'Bravo Squad',
  'Charlie Squad',
  'Delta Squad',
);

break;

case 'section':


// These must be in the order
$rankorder = array(
'MP',
  'Recruiters',
  'Drill Instructors',
);

break;
}
}

//The meat

$groups = '';

//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
    'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
    'stars' => empty($row['stars']) ? '' : substr($row['stars'],2),
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
  $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 = '" . $groups[$rank]['id'] . "' ", __FILE__, __LINE__);

  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="5" align="center" class="bordercolor">
      <tr><td colspan="7" class="catbg"><font size="4" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="70" width="85" class="profilebg" valign="top">
        <center><img src="' . $settings['images_url'] . '/' . $groups[$rank]['stars'] . '"></center></td>';
      echo '<td class="catinfo" width="25%"><b>GAMING ALIAS</b></td>';
      echo '<td class="catinfo" width="30%"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="25%"><b>LOCATION</b></td>';
      echo '<td class="catinfo" width="20%"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="40"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b>';

        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" >';
        echo '<i>' . $row2['location'] . '</i>';
        echo '</td><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> ';



//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>';
        echo '</td>';
        echo '</tr>';
}
    echo '</table><br>';
  }
}
Title: Re: Roster Page
Post by: raxavier69 on June 06, 2010, 01:38:33 AM
anyone have a working version with current smf/tp?
Title: Re: Roster Page
Post by: ZarPrime on June 06, 2010, 05:25:12 PM
raxavier69,

Not likely. :( If you really want something like this, start a new topic in the Block Code Requests Board and reference this topic.

ZarPrime
Title: Re: Roster Page
Post by: Bloodlvst on August 25, 2010, 07:44:00 AM
Quote from: raxavier69 on June 06, 2010, 01:38:33 AM
anyone have a working version with current smf/tp?

It doesn't work with 2.0?
Title: Re: Roster Page
Post by: IchBin on August 25, 2010, 03:26:10 PM
Assuming you're talking about the code in the first page. There is an image that you'll need to change with your own. Search the cdoe for rank_21.png and you'll see the image code you need to change. See if this works:
global $db_prefix, $scripturl, $txt, $user_info, $settings, $modSettings;

$groups = '';
//Does all the real work here for showing groups.
$query = tpdb_query("SELECT id_group, group_name, min_posts, online_color
FROM {$db_prefix}membergroups WHERE group_name = 'General'
ORDER BY group_name", __FILE__, __LINE__);
while ($row = tpdb_fetch_assoc($query))
{

$groups[$row['id_group']]  = array(
'id' => $row['id_group'],
'name' => $row['group_name'],
'color' => empty($row['online_color']) ? '' : $row['online_color'],
);
}
tpdb_free_result($query);

foreach ($groups as $id => $data)
{
//Now get all the user's
$query2 = tpdb_query("SELECT id_group, id_member, real_name, usertitle, email_address, hide_email, last_login, location, personal_text, total_time_logged_in, date_registered, icq, aim, yim, msn,
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>
                <td class="catbg2" width="280">Alias</td>
                <td class="catbg2" width="100">Name</td>
                <td class="catbg2" width="145">Location</td>
                <td class="catbg2" width="255">Last Active</td>
                <td class="catbg2" width="155">Contact</td>
            </tr>
            <tr>';

while ($row2 = tpdb_fetch_assoc($query2))
{
echo '
                <td class="windowbg" height="40">
                    <a href="' . $scripturl . '?action=profile;u=' . $row2[''] . '">~RoTa~ <b>
                    <font color="' . $data['color'] . '" size="3" face="verdana">' . $row2['real_name'] . '</b>[GeN]</font></a><br />
                    <font size="1"> ' . $row2['personal_text'] . '</font></a>
                </td>
                <td class="windowbg">' . $row2['usertitle'] . '</td>
                <td class="windowbg">' . $row2['location'] . '</td>
                <td class="windowbg">' . timeformat($row2['last_login']) . '</td>
                <td class="windowbg">';

//Send email row
if($row2['hide_email'] == 0)
echo '
                    <a href="mailto:', $row2['email_address'], '"><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> ';
           //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>
                </td>
            </tr>';
}
echo '
        </table>';
}
}

echo'<br />';