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

Reply
 
Thread Tools Display Modes
  #1  
Old 08-30-2005, 08:56 PM
HakkieDEV HakkieDEV is offline
 
Join Date: Jun 2004
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default modifying INSERT INTO thread query

Hiya,

I'd like to know IF its possible to modify the INSERT INTO thread query.

I've a couple of extra fields when posting a new thread, I'd like to have them being inserted into the database together with the threadtitle, dateline etc.
Reply With Quote
  #2  
Old 08-30-2005, 09:03 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Take a look at build_new_post().
Reply With Quote
  #3  
Old 08-31-2005, 02:28 PM
HakkieDEV HakkieDEV is offline
 
Join Date: Jun 2004
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I had a look in functions_newpost.php, but I can't find a hook overthere?

I've currently done:

in newthread_post_start:
PHP Code:
$vbulletin->input->clean_gpc('p''field1'TYPE_STR);
$newpost['field1'] =& $vbulletin->GPC['field1'];
$vbulletin->input->clean_gpc('p''field2'TYPE_STR);
$newpost['field2'] =& $vbulletin->GPC['field2']; 
and in threadfpdata_start:
PHP Code:
$this->validfields['field1'] = array(TYPE_STRREQ_NO);
$this->validfields['field2'] = array(TYPE_STRREQ_NO); 
But, this doesn't work. Any idea what I am doing wrong here?
Reply With Quote
  #4  
Old 09-04-2005, 02:01 PM
HakkieDEV HakkieDEV is offline
 
Join Date: Jun 2004
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry for bumping this thread, but I really want to have this fixed.
Reply With Quote
  #5  
Old 09-04-2005, 02:17 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There are Hooks

Try

newthread_post_start
PHP Code:
$vbulletin->input->clean_array_gpc('p', array('field1' => TYPE_STR'field2'TYPE_STR));
$newpost['field1'] =& $vbulletin->GPC['field1'];
$newpost['field2'] =& $vbulletin->GPC['field2']; 
threadfpdata_start
PHP Code:
$this->validfields['field1'] = array(TYPE_STRREQ_NO);
$this->validfields['field2'] = array(TYPE_STRREQ_NO); 
newpost_process
PHP Code:
if ($type == 'thread)
{
    $dataman->setr('
field1', $post['field1']);
    $dataman->setr('
field2', $post['field2']);

Reply With Quote
  #6  
Old 09-04-2005, 08:24 PM
HakkieDEV HakkieDEV is offline
 
Join Date: Jun 2004
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks KirbyDE, I owe you one!
Reply With Quote
  #7  
Old 10-26-2005, 10:56 AM
waherne waherne is offline
 
Join Date: Oct 2002
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Andreas (or KirbyDE!), thanks for the solution to HakkieDEV's query - it works perfectly. Next question focuses on editing!

Could you or anyone else tell me how one would edit data contained in those fields which were added to the thread table? I can load the original field data into the editing form but on submission, I cannot update the thread table. The issue is that the extra field names (e.g. field1, field2) are considered invalid. I think that something like the hook for threadfpdata_start is needed but I'm not sure how to go about this.

Any help very much appreciated.

W
Reply With Quote
  #8  
Old 04-25-2006, 08:14 PM
jaybolt jaybolt is offline
 
Join Date: Jun 2004
Location: UK
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Andreas
There are Hooks

Try

newthread_post_start
PHP Code:
$vbulletin->input->clean_array_gpc('p', array('field1' => TYPE_STR'field2'TYPE_STR));
$newpost['field1'] =& $vbulletin->GPC['field1'];
$newpost['field2'] =& $vbulletin->GPC['field2']; 
threadfpdata_start
PHP Code:
$this->validfields['field1'] = array(TYPE_STRREQ_NO);
$this->validfields['field2'] = array(TYPE_STRREQ_NO); 
newpost_process
PHP Code:
if ($type == 'thread)
{
    $dataman->setr('
field1', $post['field1']);
    $dataman->setr('
field2', $post['field2']);

There is a typo in this. It should be:

if ($type == 'thread')
{
$dataman->setr('field1', $post['field1']);
$dataman->setr('field2', $post['field2']);
}

Andreas - when I use this, it writes the first field fine but won't write the second field. Any ideas?
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:19 AM.


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.04235 seconds
  • Memory Usage 2,248KB
  • 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
  • (8)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete