vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Mod Help (https://vborg.vbsupport.ru/showthread.php?t=199530)

pein87 12-22-2008 03:53 PM

Mod Help
 
I was working on a mod to make te users avatar appeaer when they logged in but I havent made any progress. I moved the login to a side table that will be used a a nav bar but I cnat get the avatar to appear it will show the link but it willsay user not regetsered. I tried to take it straight from the postbit. Any sugestions? I was thinking about making another template for that but I`m afraid I dont know much about vbulletins progamming on how to make the avatar appaer if i make a new template. Can anyone help me out?

Lynne 12-22-2008 05:35 PM

Did you make sure to change the variable names from the postbit? The postbit uses $post whereas you want to use $username (like for someone else's profile) or in this case $bbusername (for the actual logged in user) in other parts of the site.

pein87 12-22-2008 07:18 PM

Yup I tired $bbuserinfo but it did not show anything. I had someone do it as a paid mod but he said it added 8 queries. There isnt away to add th users avatar without making a new template or running new queries? I seen it done on subdreamer when you log in it shows your vbulletin avatar so i thought it wold be a great idea to do the same to the forum a kind of welcome back deal to make them feel appreciated. This may soudn dumb but why ouldnt i just use the postbit avatar? Is there any other array or varibale that the avatar is stored under so i can get this mod to work with out a bunch of more queries or a new template?

Lynne 12-22-2008 07:44 PM

I've seen mods to put the avatar up near the username in the navbar area. Take a look at that modification and see how it is done. (I can't imagine it is eight extra queries!)

RLShare 12-23-2008 01:02 AM

8 queries is insane, no it should not take an extra 8 queries to grab the avatar information. There are 3 tables in reguards to the the avatar. The user table holds the avatarid if the user is using an existing avatar and there is an avatar table that holds the information about the existing avatars you add through the adminCP. You can both query with a single query checking for the users id and condition where the avatarid of the user table equals the avatar id of the avatar table. If no results are returned then you know the user is not using admin added avatar.

They could still be using a custom avatar, and there is a custom avatar table that holds that information. You query it for a result based on the usersid and if it returns a result they are using a custom avatar..

At most it should only add 2 queries, and if I were you I would query the customavatar table first as more people use custom avatars.

Dismounted 12-23-2008 02:11 AM

This can be done with no added queries. (That's right! Zero queries!) Have a look through the code for the "AVATAR_ON_NAVBAR" constant.

pein87 12-24-2008 03:39 PM

Are you for real no queries? Where can i find this at in the code? Sorry I`m fairly new to vbulletins way of programming and I only have 1 yr of php/sql experince.

Dismounted 12-25-2008 08:00 AM

A handy tool would be a mass search tool. Another handy hint is to look at fetch_avatar_from_userinfo().

pein87 12-30-2008 04:24 PM

Thanks, I searched found someone who already did it and made some adjustments to the code so it doesnt show an avatar if your a guest and did the side colum. Works like a charm at first thought you were joking with me thanks for making me do the work or else I neve would have learned anything.

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

One last question the code was bulky I tried this:

<if condition="$bbuser">
fetch_avatar_from_userinfo($user, true, false);
</if>
<else />

but it showed nothing Do I need to make a new template for this or am i missing something?

Lynne 12-30-2008 07:04 PM

$bbuser is not valid, it is $bbuserinfo

pein87 12-30-2008 07:49 PM

thanks your a dear

Dismounted 12-31-2008 05:16 AM

The function should be executed with the variable that hold the user info. Also, they will not execute inside of a template.
PHP Code:

fetch_avatar_from_userinfo($vbulletin->userinfotruefalse); 



All times are GMT. The time now is 10:57 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.02159 seconds
  • Memory Usage 1,730KB
  • 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_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (12)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