Avatar not showing on header - avatar url varible

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kanustep
    Senior Member
    • Jul 2005
    • 149
    • 3.7.x

    Avatar not showing on header - avatar url varible

    Hello,

    I'm trying to do this:



    So when the user is logged in, he will see his avatar, when the user is not logged, it will show a default one.

    This is the code I made:

    Code:
    <if condition="!is_member_of($bbuserinfo, 1, 3)">
    <a href="member.php?$session[sessionurl]u=$bbuserinfo[userid]"><img src="$prepared[avatarurl]" alt="<phrase 1="$bbuserinfo[username]">$bbuserinfo[username]</phrase>" width="48" height="48" border="0" /></a>
    <else />
    <img src="$stylevar[imgdir_misc]/defaultavatar.gif" alt="Avatar" width="48" height="48" border="0" />
    </if>
    However is not showing the avatar of the user, what is the avatar url variable for header? Is possible to do the size change without deforming the avatar too much? I saw something similar on user profiles.

    Thank you all in advance.
  • NeuroLancer
    New Member
    • Feb 2008
    • 24

    #2
    i dont think $prepared[avatarurl] will work in the header template.

    here is an example to display a users avatar on their profile within memberinfo template:

    Code:
    <img src='$avatarurl[0]' border='0' alt='Avatar'>
    called by a new plugin with hook at member_complete:

    Code:
    require_once('./includes/functions_user.php');
    $userid = $userinfo['userid'];
    $avatarurl = fetch_avatar_url($userid);
    so i guess for what you want you would just change $userinfo[userid] to $bbuserinfo[userid] and move the hook location.

    Comment

    • Kanustep
      Senior Member
      • Jul 2005
      • 149
      • 3.7.x

      #3
      Thank you NeuroLancer, I realize that is nothing done by default to add the user avatar into the header, I found a way to do it, using a plug-in.

      Thank you for you explanation

      Comment

      • Shelby
        Senior Member
        • May 2004
        • 928

        #4
        Thanks for this Neurolancer.
        Last edited by Shelby; Wed 14 May '08, 3:15pm.

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...