vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   User's avatar on a page (https://vborg.vbsupport.ru/showthread.php?t=180644)

hitmann 05-27-2008 02:25 AM

User's avatar on a page
 
When a user logs in, how do you make their avatar show on a specified location of forum?

veenuisthebest 05-27-2008 02:32 AM

you'll have to use something like this at the desired location

Code:

        <td class="$bgclass">

                <if condition="!$show['guest']">

                        <if condition="$avatarurl">
                                <a href="$vboptions[bburl]/profile.php?$session[sessionurl]do=editavatar"><img src="$avatarurl" border="0" alt="$vbphrase[edit_avatar]" /></a></if></if>
                                </td>


hitmann 05-27-2008 05:40 AM

That didn't do it. I have nothing showing up on the forum after pasting this in the header

veenuisthebest 05-27-2008 11:54 AM

that code i simply copied from the vbadvanced page...

okay try this then, this is from the postbit template

Code:

<if condition="$show['avatar']"><td class="alt2"><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a></td></if>

Dismounted 05-27-2008 12:58 PM

That will not work, as the variables required in that statement do not exist until you view a post. You need to create a plugin to fetch the avatar URL, then use that URL.

hitmann 05-27-2008 07:46 PM

Wow, that would be too advanced for me.
I guess I'd have to look for something else.

MoT3rror 05-27-2008 08:21 PM

This is what I do for the user avatar on every page.

Put this in your config.php
PHP Code:

define('AVATAR_ON_NAVBAR'true); 

Create new hook with this info.
Hook Location: fetch_userinfo
Execution order: 5
PHP code:
PHP Code:

if(defined('AVATAR_ON_NAVBAR') AND ($option FETCH_USERINFO_AVATAR) AND $vbulletin->options['avatarenabled'])
{
     require_once(
DIR '/includes/functions_user.php');
     
fetch_avatar_from_userinfo($userfalsetrue);


Plugin Active: yes

Also I am using 3.7.0 for the moment and it is working. I just download 3.7.1 about 2 hours ago and haven't got to it yet.

GameWizard 05-27-2008 10:19 PM

Just out of curiosity, could you explain what the 3 array items refer to and where they are defined?

Code:

fetch_avatar_from_userinfo($user, false, true);

MoT3rror 05-27-2008 10:37 PM

In the function fetch_userinfo(), the userinfo is contain in $user. The second parameter is to fetch the avatar thumb. The third parameter is return fake avatar or no avatar. You can read more info about fetch_avatar_from_userinfo() here.

hitmann 05-27-2008 11:33 PM

I don't get it.. I've done how you said and it's still not showing anything :S


All times are GMT. The time now is 10:55 PM.

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.01017 seconds
  • Memory Usage 1,737KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete