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

Recent

Welcome to TinyPortal. Please login or sign up.

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

Roster Page

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

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

londonhogfan

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

JPDeni

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. :)

knat

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 ?)

londonhogfan

#93
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"
Think it is covered there.

knat

Thanks alot  :D i will try it out right away..   ;)

JPDeni

#95
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>';
  }
}

londonhogfan


JPDeni

#97
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.

londonhogfan

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.

JPDeni

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.

This website is proudly hosted on Crocweb Cloud Website Hosting.