Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
  #1  
Old 01-22-2015, 01:05 PM
DJ-Dez DJ-Dez is offline
 
Join Date: Jun 2010
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default forumhome_lastpostby

Heya guys,

How would you display a users avatar in this template? I've tried plugins but the others are not that good and not what I need sadly, so decided to do it myself.

Any ideas what raw code would work to display the avatar of the last posting user?

Thx
Reply With Quote
  #2  
Old 01-22-2015, 05:05 PM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is what an avatar image looks like from postbits

Code:
<img src="image.php?u=100&amp;dateline=1309261189" alt="JoeBlow's Avatar" title="JoeBlow's Avatar">
I think you could leave out the dateline, I don't even know what's that's for. The alternative would probably to run a query against the avatar table to get avatarpath. I think you would have to do such a query for each forumbit.

To get a username and userid I think you'll need a plugin in "forumbit_display"

Code:
	$forum['lastposterid'] = $lastpostinfo['lastposterid'];
	$forum['lastposter'] = $lastpostinfo['lastposter'];
So an avatar would look like this:

Code:
<img src="image.php?u={vb:raw forum.lastposterid}" alt="{vb:raw forum.lastposter}'s Avatar" title="{vb:raw forum.lastposter}'s Avatar">
You may have to experiment around.
Reply With Quote
  #3  
Old 01-22-2015, 05:08 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
I think you could leave out the dateline, I don't even know what's that's for.
The dateline is so that if a user updates his avatar, browsers will request the new one instead of using the cached one, since the url is otherwise the same.
Reply With Quote
  #4  
Old 01-22-2015, 05:26 PM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That makes sense. But how would you get it without a query against the avatar table? The whole forum.php page seems to be constructed entirely from $vbulletin->forumcache without any query you could put a JOIN into.

I suppose the browser cache would be up to date from the last viewing of showthread
Reply With Quote
  #5  
Old 01-22-2015, 05:50 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well yeah, you're right, to do it right you'd need to do a query for each user. Or really you could call fetch_userinfo() with the FETCH_USERINFO_AVATAR parameter, that will do the query for you or get it from the cache if it's there.

What you posted above might be good enough. Maybe it doesn't matter if the avatar doesn't update on that page right away.
Reply With Quote
  #6  
Old 01-22-2015, 06:19 PM
OUTL4W OUTL4W is offline
 
Join Date: May 2013
Location: Gettysburg, Pa
Posts: 130
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you looking for something similar to this?

https://vborg.vbsupport.ru/showthread.php?t=268855
Reply With Quote
Благодарность от:
kh99
  #7  
Old 01-22-2015, 07:57 PM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

But it's for vB3. It probably wouldn't be too hard to figure out the HTML changes if the PHP is still compatible.
Reply With Quote
  #8  
Old 01-22-2015, 08:13 PM
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Location: USA
Posts: 10,929
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ummm, this one, https://vborg.vbsupport.ru/showthread.php?t=275406
Reply With Quote
Reply

Thread Tools
Display Modes

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:43 AM.


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.04645 seconds
  • Memory Usage 2,224KB
  • Queries Executed 13 (?)
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
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (1)post_thanks_box_bit
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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_postinfo_query
  • fetch_postinfo
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete