Hey guys, I'm a little new at PHP. I know the basics and all that, just have a question. I'm running an SMF install with the Tiny Portal mode, and I have a PHP article that displays a "roster" of players (I run a gaming clan). It calls it from the corresponding SMF membergroup. So my question is that if I say had a membergroup called "CS Joint Chief", but wanted to remove the "CS " portion from displaying on my "roster page", how would I go about this. Here's my code:
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(
'CS Joint Chief',
'Administrator',
'Private'
);
$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'] . "'" .
" 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'] . '">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>';
}
}