vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Custom Profile Field In Threadbits (https://vborg.vbsupport.ru/showthread.php?t=158697)

Itworx4me 09-25-2007 12:48 AM

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

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

Quote:

Originally Posted by Kirk Y (Post 1346472)
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:
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.

Itworx4me 09-27-2007 02:47 AM

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

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

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>


Dismounted 09-28-2007 06:57 AM

PHP Code:

$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


All times are GMT. The time now is 05:53 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.01137 seconds
  • Memory Usage 1,759KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (15)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete