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

[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.

akulion


Jpg

Well I haven't been focusing on this lately. We need better coders like JPdeni, Storm,etc...


Jpg

Apparently so. Maybe I'll take another whack at it. :)

Edit: The codes we have now...

The Table
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>';



The Newest Avatar

global $db_prefix;
$query = "SELECT avatar FROM {$db_prefix}members WHERE ID_MEMBER = ".$context['common_stats']['latest_member']['id'];
$exec = db_query($query);
$row = mysql_fetch_assoc($exec);
echo "<div align='center'><img src='./avatars/".$row['avatar']."' alt='".$context['common_stats']['latest_member']['name']."'><BR>".$context['common_stats']['latest_member']['link']."</div>";
mysql_free_result($exec);


Top Ten Posters
// 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);

rebelrose

Will this also pull up avatars that are not in the avatar area, you know the ones uploaded by members?


global $db_prefix;
$query = "SELECT avatar FROM {$db_prefix}members WHERE ID_MEMBER = ".$context['common_stats']['latest_member']['id'];
$exec = db_query($query);
$row = mysql_fetch_assoc($exec);
echo "<div align='center'><img src='./avatars/".$row['avatar']."' alt='".$context['common_stats']['latest_member']['name']."'><BR>".$context['common_stats']['latest_member']['link']."</div>";
mysql_free_result($exec);

stormlrd

storm runs and hides lol I keep commiting myself to so many projects but i like this one too lol.

rebelrose

I have the block up, but when I added an uploaded image it did not show for some reason.

akulion

great job JPG ill test it out today a bit later after i finish my pepsi lol

Yes rebelrose the uploaded avatars are handeled differently according to jocortina who was discussing it in another thread

we may have to dig deeper to get those working as well


akulion

we need jpdeni or eldaka or thurnok or jocortina here :D

arent we shameless? lol

This website is proudly hosted on Crocweb Cloud Website Hosting.