Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 04-07-2008, 10:19 PM
Kanustep Kanustep is offline
 
Join Date: Jul 2005
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Show avatar on header

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)">
<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.
Reply With Quote
  #2  
Old 04-08-2008, 12:37 AM
MoT3rror MoT3rror is offline
 
Join Date: Mar 2007
Posts: 423
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
  #3  
Old 04-08-2008, 03:22 PM
GameWizard's Avatar
GameWizard GameWizard is offline
 
Join Date: Apr 2004
Location: Vancouver, BC
Posts: 319
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
  #4  
Old 04-08-2008, 05:47 PM
Kanustep Kanustep is offline
 
Join Date: Jul 2005
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #5  
Old 04-10-2008, 05:25 PM
MarkJW's Avatar
MarkJW MarkJW is offline
 
Join Date: Nov 2006
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #6  
Old 04-10-2008, 06:11 PM
Kanustep Kanustep is offline
 
Join Date: Jul 2005
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #7  
Old 04-10-2008, 10:04 PM
MarkJW's Avatar
MarkJW MarkJW is offline
 
Join Date: Nov 2006
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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> 
Reply With Quote
  #8  
Old 04-11-2008, 03:14 AM
Kanustep Kanustep is offline
 
Join Date: Jul 2005
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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> 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:59 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05506 seconds
  • Memory Usage 2,253KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (4)bbcode_html
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete