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

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.

IchBin

You won't be able to "resize" theme without using some php library like GD. You could limit the HTML to only display a certain size, but that would be cutting the avatar off, and not "resizing" it.

Lord Anubis

Couldn't a function like this be applied?


'ava' => ‘<img src="', htmlspecialchars($memberContext[$row['ID_MEMBER']]['avatar']['image']), '" width="20" alt="">’,


This one is giving a parse error, but I was wondering if this would be on the right track to getting this to work

JPDeni

That'll work, but you might end up with distorted avatars. If the original is wider than 20 pixels, then the avatar will look tall and skinny. If the original is narrower than 20 pixels, the avatar will look short and fat. It might not make a whole lot of difference, but it'll be noticeable, especially to the owners of the avatars.

I think your parse error is because you've ended the line with a , instead of a ;

Lord Anubis

Hmmm...I tried changing the comma to a semicolon and still recieved a parse error here is the code thus far


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' => '<img src="', htmlspecialchars($memberContext[$row['ID_MEMBER']]['avatar']['image']), '" width="20" alt="">';
  '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="20"> '. $top_user['ava'] .'</td>
      <td align="left" width=50%>' . $top_user['link'] . '</td>
      <td align="right"> '. $top_user['count'] . '</td>
      </tr>';
}
echo '</table>';


I have been looking through it and haven't seen anything that looks outta the ordinary that would make it parse...

Now I am stumped  :uglystupid2:

JPDeni

What exactly is your parse error? It makes it a whole lot easier to find things if I know what I'm looking for.

Lord Anubis

Thats what I usually use, but in TP 1.05 it doesn't tell you which line...The block just doesn't show up

darkwind

Thanks for the code, one thing I would like is to not put a start time but to take the top posters all-time.

I know what line it is I'm just not sure what value should it be.

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

JPDeni

darkwind:
Quote
I know what line it is I'm just not sure what value should it be.


$starttime = 0;


Anubis, I just got home. I'll take a look at your code if I can find it. I have received parse code line numbers when there was a problem, so it probably is more of a logic error than a parse code error. But I'll take a look.

Lord Anubis


JPDeni

You were right about ending that line with a comma. I didn't realize it was part of an array.

I'm getting a return. At first I didn't think I was, but then I realized there were no posts in the past 24 hours, so it's logical that nothing would be there. But when I added it to my live active site, I got the list of today's posters. Are you sure you have posts within the time frame that you've set?

This website is proudly hosted on Crocweb Cloud Website Hosting.