View Full Version : New Thread - Force Update on Post Table
MrD3SAi
07-24-2009, 04:07 PM
I am creating a plugin that will have a checkbox in the newthread template. I want to setup a new plugin, but not sure what hook to use (I have tried a lot of them based on the newthread.php and functions_newpost.php) to update a value in the post table (not thread table) column to set to 1.
Thanks in advance!
Dismounted
07-25-2009, 04:48 AM
You're probably trying to find newthread_post_complete.
MrD3SAi
07-27-2009, 12:03 PM
I tried putting the below in newthread_post_complete, but it didn't update the corresponding post column "homepage" in the post table to 1 when the checkbox was checked:
if ($foruminfo['forumid'] == 19 || $foruminfo['forumid'] == 21)
{
$dataman->set_info('homepage', $post['homepage']);
}
After I click on Submit, it makes the page blank (assuming there is an error). However, it does create the thread and post, but doesn't make the homepage = 1 in the post table. Can you let me know what I should be doing on new thread create to mark the post table column "homepage" = 1 when a new thread is created with that checkbox checked?
--------------- Added 1248704503 at 1248704503 ---------------
I actually did it by using newpost_complete and a custom DB query:
if (($foruminfo['forumid'] == 19 || $foruminfo['forumid'] == 21) && $type == 'thread' && $post['homepage'] != "0")
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "post SET homepage = $post[homepage] WHERE postid = $post[postid]");
ForumsMods
07-27-2009, 01:40 PM
Did you validate homepage before??
MrD3SAi
07-27-2009, 01:52 PM
Yes, I did that in newthread_post_start:
if ($foruminfo['forumid'] == 19 || $foruminfo['forumid'] == 21)
{
$vbulletin->input->clean_array_gpc('p', array('homepage' => TYPE_STR));
$newpost['homepage'] =& $vbulletin->GPC['homepage'];
$newpost['homepage'] = ($newpost['homepage'] == "on" ? 1 : 0);
}
ForumsMods
07-27-2009, 02:23 PM
No, you have vlaidate fields before:
threadfpdata_start
$this->validfields['homepage'] = array(TYPE_STR, REQ_YES);Change newthread_post_complete to newpost_process and use setr instead of set_info
MrD3SAi
07-27-2009, 02:55 PM
Yes - I also had that in place. Sorry, didn't know what you meant. Also, I noted in the second reply that I got it working. Thanks though!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.