PDA

View Full Version : Custom Profile Field In Threadbits


Itworx4me
09-25-2007, 12:48 AM
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

Kirk Y
09-25-2007, 12:56 AM
How would you use a custom field in the threadbit template?

Itworx4me
09-25-2007, 03:40 AM
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

Itworx4me
09-26-2007, 07:58 PM
bump

Kirk Y
09-26-2007, 10:03 PM
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:
$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:
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.

Itworx4me
09-27-2007, 02:47 AM
Add a new plugin using hook location "forumdisplay_query" with the following contents:
$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

Dismounted
09-27-2007, 05:16 AM
What is the error?

Itworx4me
09-27-2007, 10:48 PM
just give me a page that says database error. doesn't actually tell me the error.

Kirk Y
09-27-2007, 11:01 PM
Go to View -> View Source and it'll have the error there.

Itworx4me
09-27-2007, 11:40 PM
<!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,10 493,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>

Dismounted
09-28-2007, 06:57 AM
$hook_query_fields .= ' , userfield.* ';
$hook_query_joins = "LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = thread.postuserid)";

danward
09-28-2007, 10:59 AM
Could I use a hook like this to allow the $show[addtolist] query to work in the postbit?

Itworx4me
09-29-2007, 03:40 AM
Thanks Kirk and Dismounted for getting this to work in threadbits. Can I bother you to show me how to get it to work on the forum home page now?

Thanks,
Itworx4me

Itworx4me
09-30-2007, 10:03 PM
any ideas?

Thanks,
Itworx4me

Itworx4me
10-02-2007, 01:08 AM
How do I get this to work on the forumhome page?

Thanks,
Itworx4me