Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
  #1  
Old 10-03-2012, 01:34 AM
bzcomputers's Avatar
bzcomputers bzcomputers is offline
 
Join Date: Apr 2012
Location: TX
Posts: 503
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to recall an additional profile field in template other than postbit?

I have an additional profile field "12" that I'm using in the post bit just fine with this code:

Code:
{vb:raw post.field12}
What I need to do is recall this information in the templates - threadbit, forumhome_lastpostby, FORUMHOME and FORUMDISPLAY.

The code above will not work in the other templates, what do I need to do to be able to call up this info?



Edit: I believe the issue may be in linking the thread to the user field - linking [userid] to [postuserid]. I could be wrong.
Reply With Quote
  #2  
Old 10-03-2012, 07:32 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by bzcomputers View Post
Edit: I believe the issue may be in linking the thread to the user field - linking [userid] to [postuserid]. I could be wrong.
Yeah, the issue is that the forum displays use data from the forum and thread tables, and it only includes the username and userid. I think that's why there is no "markup" for user names on those pages.

In the case of the threads displayed in forumdisplay, you could use a plugin on hook forumdisplay_query to add a JOIN of the userfield table to get field12, but you can only do it for either the thread starter or the last poster (since I believe you can only JOIN each table once). Otherwise you'd need to do separate queries which isn't difficult, but will add one query per thread displayed (or per user, if you figure out a way to cache the results).

For forumhome, same issue except I believe the information comes from the forum cache (so I don't think there's a hook to do a JOIN like in the forumdisplay case).
Reply With Quote
Благодарность от:
CAG CheechDogg
  #3  
Old 10-03-2012, 08:09 PM
bzcomputers's Avatar
bzcomputers bzcomputers is offline
 
Join Date: Apr 2012
Location: TX
Posts: 503
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for that.

Still a little on the novice side with vB so a couple questions on your answer.

The linking of the thread starter to field12 will definitely work in my case. I just need the field12 information for threads which are in forums that actually don't allow additional posts (so the thread starter and last poster will be the same in all instances too).

I do understand selecting the hook location for the plugin but have no clue what the actual plugin code would be to do a JOIN between the user-field12 and thread-postuserid.

Thanks for pointing me in the right direction.
Reply With Quote
  #4  
Old 10-03-2012, 08:43 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You'd do something like this, using hook forumdisplay_query:
Code:
$hook_query_fields .= ', userfield.field12 ';
$hook_query_joins .= ' LEFT JOIN ' . TABLE_PREFIX . 'userfield AS userfield ON (userfield.userid = thread.postuserid) ';

Hopefully that will do it for you.

Edit: Then of course you'd probably use {vb:raw thread.field12} in the template.
Reply With Quote
Благодарность от:
bzcomputers
  #5  
Old 10-03-2012, 10:26 PM
bzcomputers's Avatar
bzcomputers bzcomputers is offline
 
Join Date: Apr 2012
Location: TX
Posts: 503
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks again kh99 - got it working perfectly with your help.
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 01:03 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.03766 seconds
  • Memory Usage 2,201KB
  • 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
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (2)post_thanks_box_bit
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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