PDA

View Full Version : Deletion of Posts - triggers and hooks


ykkrox
09-19-2011, 10:37 PM
This forum is really helpful! Now I got some more questions to post.

So now I've created a new plugin, I wanted to be able to detect a post being deleted by a Moderator or Admin.

What hook should I use to detect this action so that I can update the database to reflect the changes right away?

Of course there is a 'soft' delete and a 'physically remove', is there an array that contains either value? A sort of deletion array?

Thanks as always!

kh99
09-19-2011, 11:39 PM
Maybe the hooks postdata_delete, threaddata_delete, and threadfpdata_delete, and you could check to see if the user is an admin or mod (see includes/class_dm_threadpost.php, the three delete() functions). Although I suppose that would also run your code when a mod or admin deleted their own post, so maybe you could also check THIS_SCRIPT == 'inlinemod'. There are some situations where threads and posts might be deleted other than through moderation. I'm not sure if those would be important to you, but if they are you may have to do additional checks.