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

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

alan s


RoarinRow

The only part that doesn't work is the avatar.  Mine has a red x even after I added one to the new member's profile.   :)

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

Jpg

I think it has top do something with
echo "<div align='center'><img src='/avatars/".$row['avatar']."'

You need to take it from the avatar directory.

JPDeni

The avatar field is right. I'm thinking that you may need to have a complete URL in your img src tag.

Jpg

I fixed it.
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);


Should work now.
See working example at Http://inflamehq.com/forum/
Look at the the bottom right.

gbingo

It likely has to do with the part which reads <img src='/avatars/" - thats a hardcoded image directory. I don't know the Variable for the Forum URL (which should be there instead)

Jpg


RoarinRow

Quote from: Jpg on August 23, 2006, 11:42:01 PM
I fixed it.
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);


Should work now.
See working example at Http://inflamehq.com/forum/
Look at the the bottom right.

Cool, that worked!  :up:  I like it, just too bad that the member has to select an avatar when they sign up.  Otherwise you get the red x.

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

Jpg

I think you can enable so the member HAS to choose an avatar when they sign up.

http://www.smfhacks.com/hacks/Avatar-Select-on-Register.html

RoarinRow


SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

This website is proudly hosted on Crocweb Cloud Website Hosting.