2017-02-26, 04:14 PM
Hi everyone,
I've got a function that is hooked to "datahandler_post_insert_post".
What already works:
- When a user posts in a certain forum (set in $ipids) the user table in the database is updated
- If the post is safed as a draft it isn't
My Problem now is that the user table should be updated if I edit a draft and turn it into a visible post. The part of datahandler/post.php that refers to that looks quite similar and it's the same hook so I don't understand why it doesn't work.
Here is my code:
Any ideas?
I've got a function that is hooked to "datahandler_post_insert_post".
What already works:
- When a user posts in a certain forum (set in $ipids) the user table in the database is updated
- If the post is safed as a draft it isn't
My Problem now is that the user table should be updated if I edit a draft and turn it into a visible post. The part of datahandler/post.php that refers to that looks quite similar and it's the same hook so I don't understand why it doesn't work.
Here is my code:
$ipids = explode(",", trim($mybb->settings['lastippost']));
if (in_array($datahandler->data['fid'], $ipids) && $datahandler->data['visible'] == 1)
{
$db->update_query("users", array('lastippost' => $datahandler->data['dateline']),"uid = '".$datahandler->data['uid']."'");
}
Any ideas?