Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-09-2010, 09:02 PM
DataHero DataHero is offline
 
Join Date: Jun 2009
Location: NL
Posts: 140
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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>
Any help would be greatly appreciated.
Reply With Quote
  #2  
Old 08-09-2010, 09:28 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #3  
Old 08-09-2010, 09:38 PM
DataHero DataHero is offline
 
Join Date: Jun 2009
Location: NL
Posts: 140
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The piece of code is in the 'showgroups_usergroupbit' template. Beside editing the templates itself, I've not done anything else to it.
Reply With Quote
  #4  
Old 08-09-2010, 09:56 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #5  
Old 08-09-2010, 10:02 PM
DataHero DataHero is offline
 
Join Date: Jun 2009
Location: NL
Posts: 140
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
I don't understand how an avatar is even showing when you have no "src" in your <img> tag
But I did try the following src:
Code:
src='image.php?u=$user[userid]'
However, that was the case which I mentioned: the avatar did display then, but an annoying 2px by 2px (or so) image file displayed with the same link as which the src is (image.php?u=X).

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.
Attached Images
File Type: jpg Capture.jpg (20.3 KB, 0 views)
Reply With Quote
  #6  
Old 08-09-2010, 10:46 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 08-10-2010, 07:07 AM
DataHero DataHero is offline
 
Join Date: Jun 2009
Location: NL
Posts: 140
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #8  
Old 08-10-2010, 03:07 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 08-11-2010, 04:29 PM
DataHero DataHero is offline
 
Join Date: Jun 2009
Location: NL
Posts: 140
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #10  
Old 08-11-2010, 04:37 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What you have done is not going to work at all if you have your avatars in the filesystem instead of the database.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:14 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04374 seconds
  • Memory Usage 2,275KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_html
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete