vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Show avatar on header (https://vborg.vbsupport.ru/showthread.php?t=175468)

Kanustep 04-07-2008 09:19 PM

Show avatar on header
 
Hello,

I'm trying to do this:

http://img217.imageshack.us/img217/2351/79776888co0.gif

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)">
<if condition="$show['avatar']">
<a href="member.php?$session[sessionurl]u=$post[userid]">
<img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" width="48" height="48" border="0" /></a>
</if>
</else>
<img src="defaultavatar.gif" alt="Avatar" width="48" height="48" border="0" />
</if>

No avatar is being showed and even the default one. What I'm missing?

Thank you for your help in advance.

MoT3rror 04-07-2008 11:37 PM

Code:

<if condition="!is_member_of($bbuserinfo, 1, 3)">
<if condition="$show['avatar']">
<a href="member.php?$session[sessionurl]u=$post[userid]">
<img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" width="48" height="48" border="0" /></a>
</if>
</else>
<img src="defaultavatar.gif" alt="Avatar" width="48" height="48" border="0" />
</if>


GameWizard 04-08-2008 02:22 PM

I think it would better to use this:

Code:

<if condition="$show['member'] AND $show['avatar']">
<a href="member.php?$session[sessionurl]u=$post[userid]">
<img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" width="48" height="48" border="0" /></a>
<else />
<img src="defaultavatar.gif" alt="Avatar" width="48" height="48" border="0" />
</if>

Firstly the $show['member'] will apply to all members, regardless of usergroup, and then the <else /> will only apply to guests.

Btw, make sure you use <else /> and not</else>

Kanustep 04-08-2008 04:47 PM

Thank you,
I try it both and keep showing to me the code after <else />, I'm trying it has an administrator and has a register user, however in both I can't see my avatar.

Both of users have avatar...This is the code:

HTML Code:

<div style="float: left; width: 50px; margin: 6px;">
  <if condition="$show['member'] AND $show['avatar']">
<a href="member.php?$session[sessionurl]u=$post[userid]">133
<img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" width="48" height="48" border="0" /></a>
<else />
789<img src="$stylevar[imgdir_misc]/defaultavatar.gif" alt="Avatar" width="48" height="48" border="0" />
</if>  </div>

This is the older one I was using:

HTML Code:

<if condition="!is_member_of($bbuserinfo, 1, 3)">
        <img src="$stylevar[imgdir_misc]/defaultavatar.gif" alt="Avatar" width="48" height="48" border="0" />
      <else />
<if condition="$show['avatar']">avatar <a href="member.php?$session[sessionurl]u=$post[userid]"> <img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]
        </phrase>
        " width="48" height="48" border="0" />
</a>
        </if>
    </if>

(I put numbers o the code to distinguish and if the code is correct)

What I'm doing wrong?

Thank you both!

--------------- Added [DATE]1207684906[/DATE] at [TIME]1207684906[/TIME] ---------------

Hello, I have a update:

HTML 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>

It work everything except the image avatar :p

MarkJW 04-10-2008 04:25 PM

I'm having the same problem with the code, with the image not working through the code is correct. I've narrowed it down to this:

PHP Code:

$prepared[avatarurl


That just doesn't want to work in header template. Anyone know why? Anyone know a workaround? Pretty please?

Kanustep 04-10-2008 05:11 PM

Hello MarkJW,

I found a way to work:

HTML Code:

<if condition="!is_member_of($bbuserinfo, 1, 3)">
<a href="member.php?$session[sessionurl]u=$bbuserinfo[userid]"><img src="$navbar_ava[0]" 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>

This code work, but need to be install a plug-in:
https://vborg.vbsupport.ru/showthread.php?t=83053

If you do this it will show the avatar in your header.

Hope it helps you!

MarkJW 04-10-2008 09:04 PM

Oh wow, thanks!

Edit: this is the conditional I used and it's working very well for me. Thanks guys!

PHP Code:

<if condition="$bbuserinfo[userid]">
<
a href="member.php?$session[sessionurl]u=$bbuserinfo[userid]"><img src="$navbar_ava[0]alt="<phrase 1="$bbuserinfo[username]">$bbuserinfo[username]</phrase>" width="48" height="48" border="0" /></a>
<else />
<
img src="$stylevar[imgdir_misc]/unknown.gif" alt="Avatar" width="48" height="48" border="0" />
</if> 


Kanustep 04-11-2008 02:14 AM

You're welcome, tell me what you want to do? The variable you use isn't correct, if you are trying to only show the avatar to the register members, use the suggestion given by GameWizard:

PHP Code:

 <if condition="$show['member'] AND $show['avatar']"></if> 



All times are GMT. The time now is 11:29 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01966 seconds
  • Memory Usage 1,753KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (4)bbcode_html_printable
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete