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

Recent

Welcome to TinyPortal. Please login or sign up.

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

Roster Page

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

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

TimUSA

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

jacortina

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

TimUSA

This worked. Thanks so much!

TimUSA

still having trouble finding how to add the country flag mod? any ideas?

jacortina

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.

TimUSA

I believe this is the feild i would like to add in the crrent location column

jacortina

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?

TimUSA

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

jacortina

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

TimUSA

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


This website is proudly hosted on Crocweb Cloud Website Hosting.