Avatar of Logged in User NOT Author
Posted: 05 July 2005 12:27 PM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  484
Joined  05-14-2004

Is there a way to display the Avatar on the logged in user on a page and not the Author of the entry?  I didn’t see a tag for this in the documentation.  Ie an avatar tag similar to {username}, {screenname}, etc.  I didn’t come up with anything on a search either.

 Signature 

Far From Perfect
Broadcasting live from Iraq via High-speed Bytes/Second Internet!

Profile
 
 
Posted: 05 July 2005 09:55 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12779
Joined  04-29-2002

I don’t have the full solution for you..

but here’s a clue.

$query = $DB->query("SELECT avatar_filename, avatar_width, avatar_height FROM exp_members WHERE member_id = '".$SESS->userdata('member_id')."'");

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 06 July 2005 07:45 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  484
Joined  05-14-2004

Thanks.  That got me started, but I am not having much luck.

Maybe I am going about it wrong. Maybe I need to learn more SQL..lol

 Signature 

Far From Perfect
Broadcasting live from Iraq via High-speed Bytes/Second Internet!

Profile
 
 
Posted: 06 July 2005 08:49 PM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12779
Joined  04-29-2002
medic119 - 06 July 2005 07:45 PM

Thanks.  That got me started, but I am not having much luck.

Maybe I am going about it wrong. Maybe I need to learn more SQL..lol

Hold on grasshopper. Others may chime in. smile

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 06 July 2005 09:28 PM   [ Ignore ]   [ # 4 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9853
Joined  06-19-2002

I just tested this to work:

<?php

global $SESS;

$member_id = $SESS->userdata['member_id'];

?>

{exp
:query sql="SELECT avatar_filename, avatar_width, avatar_height FROM exp_members WHERE member_id = <?php echo $member_id; ?>"}

{avatar_filename}
- {avatar_width} - {avatar_height}

{
/exp:query}

 Signature 

Chris Curtis
chriscurtis.org

Profile
 
 
Posted: 06 July 2005 10:54 PM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  484
Joined  05-14-2004

Danke!
I was going about it wrong.  I was trying to do the whole thing in PHP.  I had completely forgotten about the exp:query tag!.. smile
Anyway, for the archives - usage:

<?php
global $SESS;
$member_id = $SESS->userdata['member_id'];
?>

{exp
:query sql="SELECT avatar_filename, avatar_width, avatar_height FROM exp_members WHERE member_id = <?php echo $member_id; ?>"}
<img src="http://www.streetdoc.net/images/avatars/{avatar_filename}" width="{avatar_width}" height="{avatar_height}">
{/exp:query}

A little something for the Wiki maybe??

 Signature 

Far From Perfect
Broadcasting live from Iraq via High-speed Bytes/Second Internet!

Profile
 
 
Posted: 07 July 2005 01:03 AM   [ Ignore ]   [ # 6 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

wiki’d. As a note, I was going to link to your post on it but the permalink brings up a 404.

 Signature 
Profile
MSG
 
 
Posted: 07 July 2005 07:35 AM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  484
Joined  05-14-2004

Thanks for the info.  This just started happening and I don’t know why after my upgrade to 1.3.

 Signature 

Far From Perfect
Broadcasting live from Iraq via High-speed Bytes/Second Internet!

Profile
 
 
Posted: 07 July 2005 09:14 AM   [ Ignore ]   [ # 8 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  752
Joined  08-16-2003
medic119 - 07 July 2005 07:35 AM

Thanks for the info.  This just started happening and I don’t know why after my upgrade to 1.3.

Because of this, perhaps?

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 07 July 2005 01:12 PM   [ Ignore ]   [ # 9 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  484
Joined  05-14-2004

No it is not related to that.  Its a EE internal error with page not found.  If I remove the last segment (the number) the template displays fine.

 Signature 

Far From Perfect
Broadcasting live from Iraq via High-speed Bytes/Second Internet!

Profile
 
 
Posted: 07 July 2005 02:00 PM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  484
Joined  05-14-2004

FYI, the issue is a confirmed bug with the Forum extensions I was using. 
Lisa Jill the permalink now works and I updated the code to include a “default” avatar for users without an avatar.

 Signature 

Far From Perfect
Broadcasting live from Iraq via High-speed Bytes/Second Internet!

Profile
 
 
Posted: 07 July 2005 02:19 PM   [ Ignore ]   [ # 11 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

As per my PM, I hope you’ll take a moment to update the wiki page so it has the full code and link to your instructions. =)

 Signature 
Profile
MSG
 
 
Posted: 07 July 2005 02:30 PM   [ Ignore ]   [ # 12 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  484
Joined  05-14-2004

Done.

 Signature 

Far From Perfect
Broadcasting live from Iraq via High-speed Bytes/Second Internet!

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 66467 Total Logged-in Users: 30
Total Topics: 84858 Total Anonymous Users: 9
Total Replies: 455324 Total Guests: 161
Total Posts: 540182    
Members ( View Memberlist )