View Full Version : userdata_postsave hook query
Nullifi3d
10-21-2005, 04:11 PM
$this->registry->db->query_write("UPDATE " . TABLE_PREFIX . "banners SET available = available + 100 WHERE userid = " . $this->registry->userinfo['userid']);
This query gives users impressions each time they make a new post. I would like to change it so that it gives a different amount of impressions according to whether it's a new post or a new thread. How would I go about doing this?
Nullifi3d
10-27-2005, 05:55 PM
Any help on this? I have posted this twice now with no reply and it seems to be a simple fix. I just don't know the variabled to use for this hook.
Paul M
10-27-2005, 06:12 PM
Try checking the variable $type, I think that should be set to 'thread' or 'post'.
Nullifi3d
10-27-2005, 07:37 PM
i updated the hook from (which works)$this->registry->db->query_write("UPDATE " . TABLE_PREFIX . "banners SET available = available + 100 WHERE userid = " . $this->registry->userinfo['userid']);
toif ($type == "thread") {
$this->registry->db->query_write("UPDATE " . TABLE_PREFIX . "banners SET available = available + 100 WHERE userid = " . $this->registry->userinfo['userid']);
} else if ($type == "post") {
$this->registry->db->query_write("UPDATE " . TABLE_PREFIX . "banners SET available = available + 10 WHERE userid = " . $this->registry->userinfo['userid']);
}
After updating it does nothing for posts and threads.
Nullifi3d
11-01-2005, 11:17 PM
Can someone at least tell me which php document contains this hook so I can find the answer myself?
Marco van Herwaarden
11-02-2005, 09:21 AM
Sorry but i don't know the hook called 'userpost_datasave'.
Nullifi3d
11-08-2005, 08:43 PM
Sorry it's userdata_postsave.
Andreas
11-08-2005, 10:24 PM
A Hook "userpost_datasave" does not exist, at least not in standard vBulletin 3.5.1 code.
Nullifi3d
11-09-2005, 10:46 AM
Well I found class_dm_user.hp thanks to Andreas, but after taking a look I couldn't find anything relevant to defining whether or not the post is a new thread or just a post. While functions_newpost.php does contain the variable $type which seems to store thread or reply it allways adds 10 (does the else) if I change:
$this->registry->db->query_write("UPDATE " . TABLE_PREFIX . "banners SET available = available + 10 WHERE userid = " . $this->registry->userinfo['userid']);
To:
if ($type == 'thread') {
$this->registry->db->query_write("UPDATE " . TABLE_PREFIX . "banners SET available = available + 100 WHERE userid = " . $this->registry->userinfo['userid']);
} else {
$this->registry->db->query_write("UPDATE " . TABLE_PREFIX . "banners SET available = available + 10 WHERE userid = " . $this->registry->userinfo['userid']);
}
Nullifi3d
01-05-2006, 09:35 PM
Can anyone help me with this? I can't get it.
Nullifi3d
01-09-2006, 04:38 PM
I managed to temporarily fix this by using different hooks and code, but no I have to have 3 different hooks for what could be done with one (i think).
- ajax_complete
- newreply_post_complete
- newthread_post_complete
Can anyone fix the code below to work with userdata_postsave (or another 1 hook solution):if ($type == 'thread') {
$this->registry->db->query_write("UPDATE " . TABLE_PREFIX . "banners SET available = available + 100 WHERE userid = " . $this->registry->userinfo['userid']);
} else {
$this->registry->db->query_write("UPDATE " . TABLE_PREFIX . "banners SET available = available + 10 WHERE userid = " . $this->registry->userinfo['userid']);
}
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.