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 08-30-2009, 01:24 AM
testbot testbot is offline
 
Join Date: Feb 2009
Posts: 373
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default first post

is there away to pull the first post from using a plugin hook?
Reply With Quote
  #2  
Old 08-30-2009, 03:07 AM
Brandon Sheley's Avatar
Brandon Sheley Brandon Sheley is offline
 
Join Date: Mar 2005
Location: Google Kansas
Posts: 4,678
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the first post on the whole forum? or from one particular user? or from one section
Reply With Quote
  #3  
Old 08-30-2009, 03:18 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And to use where? Which hook location? Just the post id or the actual text or ?? Your question is waaaaay too general unless you just want an answer like "yes, probably".
Reply With Quote
  #4  
Old 08-30-2009, 04:10 AM
testbot testbot is offline
 
Join Date: Feb 2009
Posts: 373
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh sorry... i want to get the text from the first post in a thread and store it to a value.

$first_post =

not sure if i can use showthread_start

or if there's already something like $threadinfo[title] i could use that.

thanks for your replies!

--------------- Added [DATE]1251639047[/DATE] at [TIME]1251639047[/TIME] ---------------

Quote:
Originally Posted by Loco.M View Post
the first post on the whole forum? or from one particular user? or from one section

just the first post of every thread regardless of user or forum.
Reply With Quote
  #5  
Old 08-30-2009, 03:49 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So, you want to grab the text of the first post in every thread and put it where? We need to know where you are going to display it in order to figure out the variable name. (You know the first text (a set amount of it) is already displayed if you hover over the thread title in the forumdisplay.php page, right?)
Reply With Quote
  #6  
Old 08-30-2009, 04:29 PM
testbot testbot is offline
 
Join Date: Feb 2009
Posts: 373
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i know if i tell you where i'm going to put it you're just going to tell me to buy vbseo. i don't want that junk. lol

i'm putting it in the head description.
Reply With Quote
  #7  
Old 08-30-2009, 04:59 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Since I am barely familiar with vbseo (I know what it is, but that's all), I would never suggest to someone to buy it.

The $header is evaled before the SHOWTHREAD template is. You will have to write a query in the global_start location (perhaps) to grab the text from the first post of the thread and then do something with it.
Reply With Quote
  #8  
Old 08-31-2009, 11:38 AM
testbot testbot is offline
 
Join Date: Feb 2009
Posts: 373
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks as always Lynne. that makes sense. time to brush up on proper vbulletin queries.

--------------- Added [DATE]1251722183[/DATE] at [TIME]1251722183[/TIME] ---------------

of course i'm back.

not only does my code suck but i also don't know the db structure. i don't have phpmyadmin installed or anything so digging through tables and stuff via command line seems like a lot of work.

what jumps out at you when you look at the following.

i know this is wrong but this is what i have so far:

Code:
$thread_id_inj = $_GET['t'];
if ($thread_id_inj != '' && $_GET['styleid']==9){
	//global $db $vbulletin;
	//$get_first_post_inj = $db->query_read();

	$get_first_post_inj = $vbulletin->db->query_read("SELECT pagetext FROM " . TABLE_PREFIX . "post WHERE threadid = $thread_id_inj LIMIT 1");
}
echo $get_first_post_inj;
i get the following:

Code:
Database error in vBulletin 3.8.4:

Invalid SQL:
;

MySQL Error   : 
Error Number  : 0
Reply With Quote
  #9  
Old 08-31-2009, 01:36 PM
James Birkett James Birkett is offline
 
Join Date: Jun 2009
Posts: 633
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by testbot View Post
i know if i tell you where i'm going to put it you're just going to tell me to buy vbseo. i don't want that junk. lol

i'm putting it in the head description.
You mean similar to what RaGEZONE has (or had)? where it shows the beginning of a thread in the description of that forum?
Reply With Quote
  #10  
Old 08-31-2009, 03:09 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So you are passing both the threadid and styleid in the url? If so, you need to clean them prior to using them. example:
PHP Code:
$vbulletin->input->clean_array_gpc('r', array(
    
'threadid'   => TYPE_UINT,
    
'styleid'    => TYPE_UINT,
)); 
Then you can use $vbulletin->GPC['threadid'] or assign another variable to that value. example:

PHP Code:
$thread_id_inj $vbulletin->GPC['threadid']; 
Then, use query_first instead of query_readsince you are only expecting one result. Then you don't have to do a fetch_array (which you didn't do which is why it isn't working).

And don't echo. Assign the result to a variable and then insert the variable into the template where you want it.

You may have issues just using the pagetext as is (I can't remember). Perhaps use stripslashes or similar after you get it from the database.
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 09:34 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04694 seconds
  • Memory Usage 2,260KB
  • 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
  • (2)bbcode_code
  • (2)bbcode_php
  • (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