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: 199
  • Total: 199

Roster Page

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

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bloodlvst

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

jacortina

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'.

Bloodlvst

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!

Bloodlvst

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

G6Cad

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.

Bloodlvst

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

jacortina

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

Bloodlvst

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



jacortina

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.

Bloodlvst

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?

This website is proudly hosted on Crocweb Cloud Website Hosting.