vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Querying Postbit Hook (https://vborg.vbsupport.ru/showthread.php?t=212612)

paul41598 05-01-2009 12:56 PM

Querying Postbit Hook
 
I'm having some issues pulling this off. Its fruturating. Any suggestions?

In postbit_display_start hook

Code:

global $db, $vbulletin;

$getthread = $vbulletin->db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "thread
WHERE threadid = '". $threadinfo['threadid']."'
");

while ($getthread1 = $vbulletin->db->fetch_array($getthread))
{                       

eval('$display .= "' . fetch_template('test') . '";');
}


In postbit_legacy template I have this:

Code:

$display

In "test" template I have:

Code:

$getthread1[title]

Nothing is showing, and I have no idea why

bananalive 05-01-2009 01:37 PM

global $threadinfo; as well needed for $threadinfo['threadid']

or use $post[threadid] instead

Lynne 05-01-2009 02:30 PM

I think bananalive is correct, try $post instead of $threadinfo.

paul41598 05-01-2009 02:43 PM

THanks guys, think we're good. One other thing.

What If I wanted the $display variable to only show on the first thread/post (thread starter). RIght now its showing on every single post under it...

Whats the suggestion there?

Lynne 05-01-2009 03:15 PM

Maybe:
HTML Code:

<if condition="$post['postid']==$thread['firstpostid']">
$display
</if>


paul41598 05-01-2009 03:40 PM

I havnt tried that yet, I will. Now I have one last issue. I'm trying to display the same thing on forumdisplay. My forumdisplay query hook has:

Code:

$hook_query_fields .= ", thread_expiry";
if I put $thread[thread_expiry] in my threadbit template...Im able to pull my timestamp results just fine, but they are in unix time.

So beneath it I'm trying to do:
Code:

$thread['thread_expiry'] = vbdate($vbulletin->options['dateformat'], ,  $thread['thread_expiry']);
It's not converting it though. Is this right or do I need it in another hook? I tried putting that conversion code part in forumdisplay start hook too and no luck...it doesnt convert it

Lynne 05-01-2009 03:52 PM

What's with the extra comma in there?

You didn't say which hook location you are using for converting the date. That is the way you would get the date (but not the time).

paul41598 05-01-2009 03:57 PM

No reason for the comma..oops. For converting the data, I'm using the same hook. forumdisplay_query

Code:

$hook_query_fields .= ", thread_expiry";
$thread['thread_expiry'] = vbdate($vbulletin->options['dateformat'], ,  $thread['thread_expiry']);

That didn't work so I left the $hook_query line of code in the forumdisplay_query hook

then i tried putting

Code:

$thread['thread_expiry'] = vbdate($vbulletin->options['dateformat'], ,  $thread['thread_expiry']);
inside of forumdisplay_start hook and I tried forumdisplay_complete.

Lynne 05-01-2009 04:17 PM

The query hook adds fields to the query that is right after it in the code. So, the field isn't available until after the query. Go find that hook in the code and then see what hook you can use after the field is available to do something to the date (threadbit_display?).

paul41598 05-01-2009 05:09 PM

Lynne! Thank you!

You were right, threadbit_display was the right hook to call. It now works! Thank you so much for your help


All times are GMT. The time now is 05:00 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.01423 seconds
  • Memory Usage 1,729KB
  • 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
  • (7)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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