Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-01-2009, 12:56 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 05-01-2009, 01:37 PM
bananalive bananalive is offline
 
Join Date: Oct 2007
Location: UK
Posts: 2,802
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

or use $post[threadid] instead
Reply With Quote
  #3  
Old 05-01-2009, 02:30 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think bananalive is correct, try $post instead of $threadinfo.
Reply With Quote
  #4  
Old 05-01-2009, 02:43 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #5  
Old 05-01-2009, 03:15 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe:
HTML Code:
<if condition="$post['postid']==$thread['firstpostid']">
$display
</if>
Reply With Quote
  #6  
Old 05-01-2009, 03:40 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #7  
Old 05-01-2009, 03:52 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #8  
Old 05-01-2009, 03:57 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 05-01-2009, 04:17 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?).
Reply With Quote
  #10  
Old 05-01-2009, 05:09 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Lynne! Thank you!

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


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 06:41 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.04520 seconds
  • Memory Usage 2,250KB
  • 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
  • (7)bbcode_code
  • (1)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (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_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
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete