Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 09-25-2007, 12:48 AM
Itworx4me's Avatar
Itworx4me Itworx4me is offline
 
Join Date: Feb 2002
Posts: 210
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Custom Profile Field In Threadbits

I am wanting to post the custom field5 in the threadbit template. I tired $post[field5] but it doesn't work. Any ideas?

Thanks,
Itworx4me
Reply With Quote
  #2  
Old 09-25-2007, 12:56 AM
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
Location: Tallahassee, Florida
Posts: 2,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How would you use a custom field in the threadbit template?
Reply With Quote
  #3  
Old 09-25-2007, 03:40 AM
Itworx4me's Avatar
Itworx4me Itworx4me is offline
 
Join Date: Feb 2002
Posts: 210
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Kirk Y View Post
How would you use a custom field in the threadbit template?
On my vb site the members all use real names. Which I keep there privacy using an conditional statement to hide the members name. I want to use another conditional statement and use <else /> $post[field5]. Custom field 5 is a nickname option at registration. Is there a way to globalize $post[field5] to show on the threadbit template?

Thanks,
Itworx4me
Reply With Quote
  #4  
Old 09-26-2007, 07:58 PM
Itworx4me's Avatar
Itworx4me Itworx4me is offline
 
Join Date: Feb 2002
Posts: 210
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump
Reply With Quote
  #5  
Old 09-26-2007, 10:03 PM
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
Location: Tallahassee, Florida
Posts: 2,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Custom fields aren't queried for in the threadbit template, so you'll need to use a plugin to hook them in. Give the following a try...

Add a new plugin using hook location "forumdisplay_query" with the following contents:
Code:
$hook_query_fields .= ' , userfield.* ';
$hook_query_joins = "LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = post.userid)";
Add a new plugin using hook location "threadbit_display" with the following contents:
Code:
if ($thread['fieldX'])
{
$thread['postusername'] = $thread['fieldX'];
}
Just change the X above to the Profile Field's ID and the User's actual username will be switched out with the nickname, if they've specified one.
Reply With Quote
  #6  
Old 09-27-2007, 02:47 AM
Itworx4me's Avatar
Itworx4me Itworx4me is offline
 
Join Date: Feb 2002
Posts: 210
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:

Add a new plugin using hook location "forumdisplay_query" with the following contents:
Code:
$hook_query_fields .= ' , userfield.* ';
$hook_query_joins = "LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = post.userid)";
Thanks Kirk

I am getting a database error with the above plugin enabled. Any ideas?

Thanks,
Itworx4me
Reply With Quote
  #7  
Old 09-27-2007, 05:16 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What is the error?
Reply With Quote
  #8  
Old 09-27-2007, 10:48 PM
Itworx4me's Avatar
Itworx4me Itworx4me is offline
 
Join Date: Feb 2002
Posts: 210
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

just give me a page that says database error. doesn't actually tell me the error.
Reply With Quote
  #9  
Old 09-27-2007, 11:01 PM
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
Location: Tallahassee, Florida
Posts: 2,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Go to View -> View Source and it'll have the error there.
Reply With Quote
  #10  
Old 09-27-2007, 11:40 PM
Itworx4me's Avatar
Itworx4me Itworx4me is offline
 
Join Date: Feb 2002
Posts: 210
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>www.nitromater.com Database Error</title>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<style type="text/css">
	<!--	
	body { background-color: white; color: black; }
	#container { width: 400px; }
	#message   { width: 400px; color: black; background-color: #FFFFCC; }
	#bodytitle { font: 13pt/15pt verdana, arial, sans-serif; height: 35px; vertical-align: top; }
	.bodytext  { font: 8pt/11pt verdana, arial, sans-serif; }
	a:link     { font: 8pt/11pt verdana, arial, sans-serif; color: red; }
	a:visited  { font: 8pt/11pt verdana, arial, sans-serif; color: #4e4e4e; }
	-->
	</style>
</head>
<body>
<table cellpadding="3" cellspacing="5" id="container">
<tr>
	<td><img src="http://www.nitromater.com/image.php?type=dberror" alt="Database Error" width="48" height="48" /></td>
	<td id="bodytitle" width="100%">Database error</td>
</tr>
<tr>
	<td class="bodytext" colspan="2">The www.nitromater.com database has encountered a problem.</td>
</tr>
<tr>
	<td colspan="2"><hr /></td>
</tr>
<tr>
	<td class="bodytext" colspan="2">
		Please try the following:
		<ul>
			<li>Load the page again by clicking the <a href="#" onclick="window.location = window.location;">Refresh</a> button in your web browser.</li>
			<li>Open the <a href="/">www.nitromater.com</a> home page, then try to open another page.</li>
			<li>Click the <a href="javascript:history.back(1)">Back</a> button to try another link.</li>
		</ul>
	</td>
</tr>
<tr>
	<td class="bodytext" colspan="2">The www.nitromater.com forum technical staff have been notified of the error, though you may <a href="mailto:">contact them</a> if the problem persists.</td>
</tr>
<tr>
	<td class="bodytext" colspan="2">&nbsp;<br />We apologise for any inconvenience.</td>
</tr>
</table>


<!--
Database error in vBulletin 3.6.8:

Invalid SQL:

		SELECT  
			thread.threadid, thread.title AS threadtitle, thread.forumid, pollid, open, replycount, postusername, postuserid, thread.iconid AS threadiconid,
			thread.lastpost, thread.lastposter, thread.lastpostid, thread.dateline, IF(views&lt;=replycount, replycount+1, views) AS views, notes, thread.visible, sticky, votetotal, thread.attach,
			hiddencount, deletedcount
			
			
			
			
			, vbookie_item_id , userfield.* 
		FROM thread AS thread
			
			
			
			
			
			
			LEFT JOIN userfield AS userfield ON(userfield.userid = user.userid)
		WHERE thread.threadid IN (0,10525,10523,10457,10175,10518,10520,10412,10502,10396,10486,10465,10491,9844,10392,10496,10449,10493,10443,10515,10466,10079) 
		ORDER BY sticky DESC, lastpost DESC;

MySQL Error  : Unknown column 'user.userid' in 'on clause'
Error Number : 1054
Date         : Thursday, September 27th 2007 @ 07:38:49 PM
Script       : http://www.nitromater.com/forumdisplay.php?f=5
Referrer     : http://www.nitromater.com/staging-lanes/
IP Address   : 76.105.147.62
Username     : Unregistered
Classname    : vB_Database
-->


</body>
</html>
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 03:26 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06345 seconds
  • Memory Usage 2,264KB
  • Queries Executed 11 (?)
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
  • (4)bbcode_code
  • (2)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
  • (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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete