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: 210
  • Total: 211
  • @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.

texasflats

The last one works for me also, thank you IchBinâ,,¢

jabroni pkp

threw this on our site today and have to say that its a quality block. thanks for putting it up

nitishthelegendkiller

First of all, i really liked this script.I started a competition  in my site.I wanted certain members to be excluded.See, i have got 1 bot working from 1 id.I started top poster of the month comp. .That bot welcomes all the members(SMF welcome mod).So, i wanted that bot not to be displayed in the top posters.

Any help?

JPDeni

I assume from your post that you have a script that you refer to as a bot. I wouldn't know how to alter that script unless I could see it.

nitishthelegendkiller

No, several other posters like 5-6 normal members doesn't want to participate.Its ok to me but they just don't want their names in the list, as its a post based so they also cannot do about it.So, i was looking for some script so that this script ignores few users if i type in their ids, or id no. or something...

JPDeni

I really got it wrong, didn't I? :)

You can add a line to the query.

Before


ORDER BY m.posts DESC


you can add


AND m.ID_MEMBER NOT IN (34,87,156)


substituting the numbers of the people you want to exclude.

darkwind

#116
Quote from: JPDeni on October 19, 2006, 01:58:12 AM
Sure. That's easier to do than what I have above.

You want just a general top x number of posters, right? No time limit?


$numberofposters = 5; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");

foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}


Edited to make the variables a little neater.

Hi,

Great piece of code!

I got this to work and modified it a little so that it shows the rank(top poster is #1) of the poster. What i wanted to know is how can I add th user's avatar with a set width and height, say, 20px x 20px.

Help will be very much appreciated.

Thanks in advance.

darkwind

JPDeni

I don't know. I've never figured out how to work with avatars.

And please don't change the font size in your posts. Some of us have been around a few more years than others and our eyes aren't as good as they used to be. I had to copy your text and paste it into a text editor in order to be able to read it.

darkwind

ok. noted. my apologies.

hope someone will be able to shed some light.

thanks.

Lord Anubis

I got it working with the avatar, using this code


global $db_prefix, $scripturl, $memberContext, $txt, $modSettings, $context, $settings, $options;

$starttime = strtotime('24 hours ago');
$list_count = 10;

$poster = array();

$request = db_query("
SELECT  m.ID_MEMBER, COUNT(m.ID_MEMBER) as postCount
FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b)
WHERE m.posterTime > " . $starttime . "
AND t.ID_TOPIC = m.ID_TOPIC
AND b.ID_BOARD = t.ID_BOARD" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? " AND b.ID_BOARD != $modSettings[recycle_board]" : '') . "
GROUP BY m.ID_MEMBER
ORDER BY postCount DESC LIMIT " . $list_count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request))
{
    loadMemberData(array($row['ID_MEMBER']));
    loadMemberContext($row['ID_MEMBER']);
$poster[$row['ID_MEMBER']] = array (
  'id' => $row['ID_MEMBER'],
  'count' => $row['postCount'],
   'ava' =>$memberContext[$row['ID_MEMBER']]['avatar']['image'],
  'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $memberContext[$row['ID_MEMBER']]['name'] . '">' . '<font color="' . $memberContext[$row['ID_MEMBER']]['group_color'] . '">' . $memberContext[$row['ID_MEMBER']]['name'] . '</font>' . '</a>' );
}
mysql_free_result($request);

echo '<table width=100%>';
foreach($poster as $top_user)
{
echo '<tr>
      <td align="left" width=10%>' . $top_user['ava'] .  '</td>
      <td align="left" width=80%>' . $top_user['link'] . '</td>
      <td align="right"> '. $top_user['count'] . '</td>
      </tr>';
}
echo '</table>';


The only problem is the avatars need to be resized

here is a screenshot of what I have so far:

This website is proudly hosted on Crocweb Cloud Website Hosting.