View Full Version : Mod Help
pein87
12-22-2008, 03:53 PM
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 1230661797 at 1230661797 ---------------
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.
fetch_avatar_from_userinfo($vbulletin->userinfo, true, false);
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.