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: 1
  • Guests: 211
  • Total: 212
  • @rjen

Top posters

Started by JPDeni, September 20, 2006, 01:27:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

insanemustang


texasflats

I tried it also, it still shows Mods and Admins. But I DO appreciate the effort!

Quote from: IchBinâ,,¢ on January 02, 2008, 04:47:26 PM
Headed out the door, so this was quick and untested. I'll check back later to see if it works.
global $db_prefix, $scripturl, $modSettings;

$memberstoshow = 7;
$matchperiod = false;
$countmodsandadmins = true; // not yet implemented
// Change this to the time you want the contest to start [http://www.onlineconversion.com/unix_time.htm]
$starttime = time() - 604800; // Last week posters
$endtime = time();  // Change this to the time you want the contest to end
$where_period = '';

if (!empty($modSettings['MemberColorLink'])) // check if MemberColorLink mod is installed and enabled         
{
    if ($matchperiod) // select only posts matching period
        $where_period = "AND m.posterTime > $starttime AND m.posterTime < $endtime";
    $query = db_query(
        "SELECT m.realName, m.ID_GROUP, m.ID_MEMBER, mg.onlineColor, m.posts
         FROM {$db_prefix}members AS m
         LEFT JOIN {$db_prefix}membergroups AS mg ON (m.ID_GROUP = mg.ID_GROUP AND m.ID_GROUP)
         $where_period
         ORDER BY m.posts DESC
         LIMIT 0,$memberstoshow", __FILE__, __LINE__);
}
else
{
    if ($matchperiod) // select only posts matching period
        $where_period = "WHERE posterTime > $starttime AND posterTime < $endtime";
    $query = db_query(
        "SELECT realName, ID_GROUP, ID_MEMBER, posts
         FROM {$db_prefix}members
         $where_period
         ORDER BY posts DESC
         LIMIT 0,$memberstoshow", __FILE__, __LINE__);
}

$firstrecord = true;
while ($row = mysql_fetch_assoc($query))
{
// Change the ID_GROUP 1 and 2 here to match the groups you don't want in the output
if ($row['ID_GROUP'] != 1 && $row['ID_GROUP'] != 2)
{
if ($firstrecord)
    {
        $biggest = $row['posts'];
        $firstrecord = false;
    }
    $bar_length = intval(($row['posts']/$biggest) * 40);

    if(isset($row['onlineColor']))
        $style = 'color: '. $row['onlineColor'];
    else
        $style = '';
}
    echo '
    <table width="100%" border="0">
    <tr>
    <td><div class="smalltext"><b><a style="' . $style . '" href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a></b> (' . $row['posts'] . ')</div></td>
    <td><div align="right"><img src="' . $settings['images_url'] . '/bar.gif" width="' . $bar_length . '" height="10" title="' . $bar_length*2.5 . '%" alt="" /></div></td>
    </tr>
    </table>
    ';
}


I put a comment in the code on what you need to change. So please read the code comment I put in there.

IchBin

The numbers 1 and 2 in this code are the ID numbers for your groups in SMF that you DON'T want to show. You can get the ID number by hovering your mouse over the link in the member groups section of your admin. Just exchange your numbers with these numbers.

Change this line:
if ($row['ID_GROUP'] != 1 && $row['ID_GROUP'] != 2)

To this:
if ($row['ID_GROUP'] != 1 || $row['ID_GROUP'] != 2)

See if this works. Still haven't had a chance to test it as I'm at work.

texasflats

I'm sorry, I should have mentioned that I, well in fact 1 and 2 were the membergroups I wanted to exclude.

Thanks again.

IchBin

So based on your last message, I have no idea whether its working for you or not...lol

insanemustang

Ich, I put this

if ($row['ID_GROUP'] != 1 || $row['ID_GROUP'] != 2) into the spot, and it still has admins and moderators included in the list. 

Thank you for trying to help, I know you will figure it out.

texasflats

lol sorry... No it didn't work.

Quote from: IchBinâ,,¢ on January 04, 2008, 03:21:33 AM
So based on your last message, I have no idea whether its working for you or not...lol

IchBin

Ok, lemme think on this for a bit. Don't know why it wouldn't work. Maybe I'll try an array later to see if it makes a difference. Bring the topic up if you don't see something by the end of Saturday.

IchBin

Well fork me sideways, it worked on my site with this code. Which seems to be the same as I posted above. Can you try this please.

global $db_prefix, $scripturl, $modSettings;

$memberstoshow = 7;
$matchperiod = false;
$countmodsandadmins = true; // not yet implemented
// Change this to the time you want the contest to start [http://www.onlineconversion.com/unix_time.htm]
$starttime = time() - 604800; // Last week posters
$endtime = time();  // Change this to the time you want the contest to end
$where_period = '';

if (!empty($modSettings['MemberColorLink'])) // check if MemberColorLink mod is installed and enabled         
{
    if ($matchperiod) // select only posts matching period
        $where_period = "AND m.posterTime > $starttime AND m.posterTime < $endtime";
    $query = db_query(
        "SELECT m.realName, m.ID_GROUP, m.ID_MEMBER, mg.onlineColor, m.posts
         FROM {$db_prefix}members AS m
         LEFT JOIN {$db_prefix}membergroups AS mg ON (m.ID_GROUP = mg.ID_GROUP AND m.ID_GROUP)
         $where_period
         ORDER BY m.posts DESC
         LIMIT 0,$memberstoshow", __FILE__, __LINE__);
}
else
{
    if ($matchperiod) // select only posts matching period
        $where_period = "WHERE posterTime > $starttime AND posterTime < $endtime";
    $query = db_query(
        "SELECT realName, ID_GROUP, ID_MEMBER, posts
         FROM {$db_prefix}members
         $where_period
         ORDER BY posts DESC
         LIMIT 0,$memberstoshow", __FILE__, __LINE__);
}

$firstrecord = true;

while ($row = mysql_fetch_assoc($query))
{
// Change the ID_GROUP 1 and 2 here to match the groups you don't want in the output
if ($row['ID_GROUP'] != 1 && $row['ID_GROUP'] != 2)
{
if ($firstrecord)
    {
        $biggest = $row['posts'];
        $firstrecord = false;
    }
    $bar_length = intval(($row['posts']/$biggest) * 40);

    if(isset($row['onlineColor']))
        $style = 'color: '. $row['onlineColor'];
    else
        $style = '';

    echo '
    <table width="100%" border="0">
    <tr>
    <td><div class="smalltext"><b><a style="' . $style . '" href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a></b> (' . $row['posts'] . ')</div></td>
    <td><div align="right"><img src="' . $settings['images_url'] . '/bar.gif" width="' . $bar_length . '" height="10" title="' . $bar_length*2.5 . '%" alt="" /></div></td>
    </tr>
    </table>';
    }
}

insanemustang

Ich your a genius.  Thank you sir.

This website is proudly hosted on Crocweb Cloud Website Hosting.