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

[Block] Newest member block with Avatar image which links to their profile

Started by gbingo, August 23, 2006, 06:04:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jpg

You can thank me for the link later. :)

Thanks gbingo for the cool snippet!

Edit: Gbingo..you too can thank me later.

akulion

Thanks for the code its very nice

hey how about a block which shows the last 5 members and their avatars as well?

Only the avatars could be resized to a smaller size so we get a block like "recent topics" only this one would have recent members

And along side could be top 5 members with avatars

just a thought...anone wana take a crack at it?


Jpg

It's supported by the 'latest_member' code.
Is it possible for this???

Maybe you can if you enable the code to remember the users "user #" and subtract one off the total. And then set up the code like that. Me being not that smart with php, won't know how to accomplish something like this. :\

akulion

well the idea in my head is this:

I made an image to best illustrate it...



It is totally possible - its just a matter of who wants to take a crack at    iit:P

Jpg

I understand. So basically something with member stats.
Now that we have the avatar code it shouldn't be that hard. But making the boxes and doing that could be.
Is there a top poster code?


Edit:Wow I have 1234 posts! :\

akulion

lol yea everyone has 1234 posts

the making the boxes isnt very hard at all its just a matter of declaring the table within echo statements to get the correct layout

The table layout code will be exactly like below, but where ti says in CAPS the code for the relevant stuff needs to be added.



echo '<table border="1" width="100%" id="table1" style="border-collapse: collapse">
<tr>
<td colspan="5">Member Stats</td>
</tr>
<tr>
<td rowspan="4">';
CODE FOR FORUM STATS HERE;
echo '</td>
<td colspan="2">Newest Members</td>
<td colspan="2">Top Posters</td>
</tr>';

PHP CODE TO MAKE IT LOOP FOR EACH FOR TOP 3

echo' <tr>
<td>CODE FOR AVATAR NEW MEMBER</td>
<td>CODE FOR NAME NEW MEMBER</td>
<td>CODE FOR AVATAR TOP POSTER</td>
<td>CODE FOR POSTS & TOPICS INFO TOP POSTER</td>
</tr>';



That should do the trick really but now the part is getting the PHP codes for those specific queries

Jpg

What is the variable for  Top Poster?
Is it ['top_poster']?
I highly doubt that...

akulion

hey do u know which file the Stats are called in?

Cos having a look at that will give us 90% of the info

The only thing that will remain is the Newest Members, for that I suspect we will require some PHP coding for doing that specifically - the minus 1 thing like u said

Jpg

I was one step ahead of you.
I was looking at it 30 minutes before you posted.


// Poster top 10.
$members_result = db_query("
SELECT ID_MEMBER, realName, posts
FROM {$db_prefix}members
WHERE posts > 0
ORDER BY posts DESC
LIMIT 10", __FILE__, __LINE__);
$context['top_posters'] = array();
$max_num_posts = 1;
while ($row_members = mysql_fetch_assoc($members_result))
{
$context['top_posters'][] = array(
'name' => $row_members['realName'],
'id' => $row_members['ID_MEMBER'],
'num_posts' => $row_members['posts'],
'href' => $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'] . '">' . $row_members['realName'] . '</a>'
);

if ($max_num_posts < $row_members['posts'])
$max_num_posts = $row_members['posts'];
}
mysql_free_result($members_result);

foreach ($context['top_posters'] as $i => $poster)
$context['top_posters'][$i]['post_percent'] = round(($poster['num_posts'] * 100) / $max_num_posts);

akulion

LOL

I was just posting that

***edit***

ok ill post another bit: Top 10 Topic Starters



// Topic poster top 10.
$members_result = db_query("
SELECT ID_MEMBER, realName
FROM {$db_prefix}members
WHERE ID_MEMBER IN (" . implode(', ', array_keys($members)) . ")
GROUP BY ID_MEMBER
ORDER BY FIND_IN_SET(ID_MEMBER, '" . implode(',', array_keys($members)) . "')
LIMIT 10", __FILE__, __LINE__);
$context['top_starters'] = array();
$max_num_topics = 1;
while ($row_members = mysql_fetch_assoc($members_result))
{
$context['top_starters'][] = array(
'name' => $row_members['realName'],
'id' => $row_members['ID_MEMBER'],
'num_topics' => $members[$row_members['ID_MEMBER']],
'href' => $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'] . '">' . $row_members['realName'] . '</a>'
);

if ($max_num_topics < $members[$row_members['ID_MEMBER']])
$max_num_topics = $members[$row_members['ID_MEMBER']];
}
mysql_free_result($members_result);

foreach ($context['top_starters'] as $i => $topic)
$context['top_starters'][$i]['post_percent'] = round(($topic['num_topics'] * 100) / $max_num_topics);



This website is proudly hosted on Crocweb Cloud Website Hosting.