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

[Block] Top Posters with avatar

Started by IchBin, June 22, 2009, 08:30:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JPDeni

This is the code that prints out the information and it's what you're going to need to change:



// Output our array of users with avatar, posts, and name
echo '
<table cellpadding="0" cellspacing="8">';

foreach ($users as $user)
{
echo '
<tr>
<td>',empty($user['avatar']['image']) ? '<a href="'.$user['href'].'"><img src="'.$settings['images_url'].'/noavatar.gif" width="'.$width.'" height="'.$height.'" alt="" title="'.$user['name'].'" /></a>' : '<a href="'.$user['href'].'"><img '.$user['avatar']['image'].'</a>';
echo '
</td>
<td><h5 style="margin: 4px;">'.$user['link'].'</h5><h5 style="margin: 4px;">'. $user['posts'] .'</h5></td>
</tr>';
}

echo '
</table>';


And this is what you would change it to



foreach ($users as $user)
{
echo $user['link'] , ' | ' , $user['posts'] , '<br />' ,
                       empty($user['avatar']['image']) ? '<a href="'.$user['href'].'"><img src="'.$settings['images_url'].'/noavatar.gif" width="'.$width.'" height="'.$height.'" alt="" title="'.$user['name'].'" /></a>' : '<a href="'.$user['href'].'"><img '.$user['avatar']['image'].'</a>';
                 echo '<br /><br />';
}

Kimmen

Nice, thanks Deni, that works like a charm  :-*

Greets
Kimmen

shane is my name

Hi All, I had tried this code out on SMF 1.1.10 TP 1 beta5 and it worked great.
but the other day, I upgraded to SMF 2.0 RC3 and TP 1 beta 5-1 and I set up a block to use this code, but it didn't work.  Is there some new formatting that needs to be done with this now to work with new tp beta 5-1?

G6Cad

Yes, it needs updating as SMF have changed a lot between the versions from 1.1 to rc3
Cant tell you exactly what to change though as i dont know, hopefully one of the coders or the origin block code creator can help you with it :)

shane is my name

Oh ok, I just wanted to make sure it wasn't just my install.  I'll keep messing with it.  :)
Thanks.


shane is my name

I tried the code in that link that you pasted Ichbin, but it still didnt work.  I see that it says "only tested on 1.1.11",

I have played with the code forever and not understanding why it would not work. Does anyone know Whats so different about the new php blocks that make old code not work?




IchBin

Ah my bad, I thought that was one I updated for SMF2. I'll have to get to that ASAP.

shane is my name

thanks man, that Top Posters is a great code. 
What is it that has to be updated with the php codes?  Just curious because it seems like a few are not working. Is it because variables have different names now? and thats why they dont work? Im just trying to learn this. :) 

IchBin

Depends on the code, but generally the differences are the way SMF2 makes the database calls. They've also change $txt strings as well as table row names. Things like realName have become real_name for compatibility with the other databases they now support.

This website is proudly hosted on Crocweb Cloud Website Hosting.