The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Problems with avatar if conditional
I'm currently working on overhauling the entire showgroups template, but it seems I've come across one small issue that I'd like to fix before releasing my first 'mod'. Apparently, I've added an if conditional for showing the avatar. As such, I want it so that if a user has an avatar, it'll be displayed. Otherwise, it won't. In my case, however, neither will appear.
If I take away the if conditional, the avatar does appear, but then an annoying 2px by 2px image file appears for those who don't have an avatar. Here's the code I'm using for the avatar bit: HTML Code:
<if condition="$show['avatar']"> <a href="member.php?$session[sessionurl]u=$userinfo[userid]"><img class="thumbnailAvatar" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" style="<if condition="$userinfo['avwidthpx'] > 60"> max-width:60px !important; width:auto; height:auto;<else />display:inline;</if>" /></a> </if> |
#2
|
||||
|
||||
Which template is this in? And it's on the showgroups.php page? Is $show['avatar'] defined in the showgroups.php page? Or have you added a plugin to define it - if so, where and what are the contents?
|
#3
|
|||
|
|||
The piece of code is in the 'showgroups_usergroupbit' template. Beside editing the templates itself, I've not done anything else to it.
|
#4
|
||||
|
||||
I don't understand how an avatar is even showing when you have no "src" in your <img> tag and when $userinfo is not even the variable being used in that template. :/ Who's avatar is showing? Do you have a link to this page?
|
#5
|
|||
|
|||
Quote:
Code:
src='image.php?u=$user[userid]' And I'd rather keep the board's url private from these boards as of yet, as it's in a beta still. I could PM you it however, if you'd like. Edit: see attachment. |
#6
|
||||
|
||||
You cannot use image.php?u=$user[userid]. That is only valid if the avatar is in the database, not filesystem (and it's not complete at that - you should have &dateline=xxx on the end of it).
Take a look at the $posts query in showthreads.php around line 989. Look at the way the customavatar gets included. You need to include that in part of the query in showgroups.php (which is going to be a bit difficult since there isn't a hook to use). Then look at class_postbit.php, the function preocess_registered_user() where the avatar gets processed and $show['avatar'] gets defined. That is the sort of thing you will need to put into your code somewhere. |
#7
|
|||
|
|||
I took a look at both files and at the right location (which you mentioned). I'm not an expert at PHP but do understand most statements and whatnot. However, I did a search and came across this post.
If what Brad has said is true, where would I have to put the code? That is, the script. Cheers. Edit: Well I've added a plugin with the contents of the first code block that Brad posted (see link), and tried global_start. That didn't bring up errors, but it wasn't displayed either. Then I tried the showgroups_complete, showgroups_start and showgroups_usergroup, which gave me two errors (the page didn't stop loading though). |
#8
|
||||
|
||||
Brad's script will not work for you without quite a few changes (if even then). It's for getting the avatar of the person viewing the page - you - which is different than getting it for someone else in a query.
|
#9
|
|||
|
|||
So I'm pretty much better off leaving that 2px / 2px image for those who don't have an avatar, than to try getting this to work? I've been messing around and tried to include some query after looking at said PHP files more, but I couldn't.
|
#10
|
||||
|
||||
What you have done is not going to work at all if you have your avatars in the filesystem instead of the database.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|