vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Plugin to check for members avatar in footer (https://vborg.vbsupport.ru/showthread.php?t=203611)

glennybee 01-30-2009 01:30 PM

Plugin to check for members avatar in footer
 
Hi folks,

I'm coding a side column in the footer template and I want to show the members avatar at the top. I can't use the code from the postbit templates because they don't parse in the footer.

I can use this to show the avatar (avatars are stored in the filesystem):

HTML Code:

<div align="center">
<a href="member.php?$session[sessionurl]u=$bbuserinfo[userid]"><img src="customavatars/avatar$bbuserinfo[userid]_$bbuserinfo[avatarrevision].gif" alt="$bbuserinfo[username]'s Avatar" /></a>
</div>

But if a member doesn't use an avatar you get the red cross and it looks crap.

So I need a conditional to check for an avatar before trying to show it. The following don't work:

Code:

<if condition="$show['avatar']">
<if condition="$avatarurl">
<if condition="$bbuserinfo['avatar']">

So I'm guessing I need to create a plugin to check for this.

Can anyone help please?

Thanks! :)

Dismounted 01-31-2009 02:58 AM

The "proper" way to fetch the current user's avatar and display it is by using the "AVATAR_ON_NAVBAR" constant and fetch_avatar_from_userinfo(). Bring out a mass search tool and search for the constant, you will see how it all ties together.

(BTW, I've also posted this in many other threads before, you may want to search for those threads as well.)

glennybee 02-01-2009 04:42 PM

Thanks for the direction Dismounted. I have searched for those terms and I see that it's what I'm looking for but my knowledge of PHP is limited and I'd appreciate it if you could help me further please?

Thanks! :)

Dismounted 02-03-2009 05:37 AM

Set the constant to true, and run fetch_avatar_from_userinfo() to fetch the avatar URL.


All times are GMT. The time now is 04:50 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.02307 seconds
  • Memory Usage 1,716KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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