Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

August 19, 2022, 04:45:33 AM

Login with username, password and session length
Members
  • Total Members: 3843
  • Latest: Tricky
Stats
  • Total Posts: 193479
  • Total Topics: 21088
  • Online today: 51
  • Online ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 0
Guests: 45
Total: 45

Author Topic: [Block] Newest member block with Avatar image which links to their profile  (Read 55255 times)

0 Members and 1 Guest are viewing this topic.

gbingo

  • Guest
Hi, very new here, thought I'd take a stab at a new block. I'd like to create a "newest member" block which shows the newest member to the forum, their avatar, and links to their profile. I'm going to attempt to start building this block by borrowing the newest member code from the bottom of the stock SMF template. Wish me luck :)
« Last Edit: May 14, 2009, 11:50:50 AM by G6 »

Offline RoarinRow

  • Hero Member
  • *****
  • Posts: 1034
  • Ride my AV!
    • Avalanche Style
Re: Newest member block with Avatar image which links to their profile
« Reply #1 on: August 23, 2006, 11:05:40 AM »
Good luck, looking forward to the code  :up:

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

Offline Jpg

  • Hero Member
  • *****
  • Posts: 591
Re: Newest member block with Avatar image which links to their profile
« Reply #2 on: August 23, 2006, 11:09:27 AM »
Good luck. I hope you are done soon so I can put it on my site. :)

gbingo

  • Guest
Re: Newest member block with Avatar image which links to their profile
« Reply #3 on: August 23, 2006, 01:33:19 PM »
Well getting the newest member was easy:
echo $context['common_stats']['latest_member']['link'];

Now to retrieve their avatar

Offline Jpg

  • Hero Member
  • *****
  • Posts: 591
Re: Newest member block with Avatar image which links to their profile
« Reply #4 on: August 23, 2006, 01:44:37 PM »
You can take it off the roster page. I know you can use the code for the avatar.

gbingo

  • Guest
Re: Newest member block with Avatar image which links to their profile
« Reply #5 on: August 23, 2006, 01:57:29 PM »
Roster page? is that part of Tinyportal or SMF?

alan s

  • Guest
Re: Newest member block with Avatar image which links to their profile
« Reply #6 on: August 23, 2006, 02:03:34 PM »
What file are you pulling the code from?? oh and the ssi feed for the member would be

<?php ssi_latestMember(); ?>

gbingo

  • Guest
Re: Newest member block with Avatar image which links to their profile
« Reply #7 on: August 23, 2006, 02:12:52 PM »
I was pulling it from SMF's theme template

gbingo

  • Guest
Re: Newest member block with Avatar image which links to their profile
« Reply #8 on: August 23, 2006, 03:24:23 PM »
All done! Here's my code: If someone can make it more efficient or flexible I'd appreciate it, but this works fine on my site:

Code: [Select]
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);
« Last Edit: August 30, 2006, 05:13:25 AM by Maxâ„¢ »

Offline Jpg

  • Hero Member
  • *****
  • Posts: 591
Re: Newest member block with Avatar image which links to their profile
« Reply #9 on: August 23, 2006, 03:28:58 PM »
Let me test it out!
Hopefully it works!
:)

Edit: Hmmm...the avatar isn't showing.
« Last Edit: August 23, 2006, 03:35:19 PM by Jpg »