Hiya,
I want to trigger a query when a user replys to a specific forum.
The stuff below is to make sure the query only gets triggered once per thread, thats what I was thinking to do with $result.
Currently I have in hook "newpost_complete":
PHP Code:
if ($type != 'thread')
{
if ($foruminfo['specificforum'] == 1)
{
$query = $vbulletin->db->query_first("SELECT postid FROM " . TABLE_PREFIX . "post WHERE userid = " . $vbulletin->userinfo['userid'] . " AND threadid=$threadinfo[threadid] ORDER BY dateline LIMIT 1");
$result= $query['postid'];
if ($result== '')
{
$vbulletin->db->query_write("query stuff here");
}
}
}
Also, what is the difference between:
$vbulletin->db->query_first
and
$db->query_first
?
(the last one gives some weird redirect error about a duplicate thread/post, wich it clearly isn't, while the first one does process allright, but it still doesn't do what I want).