PDA

View Full Version : Intercept Post/Edit Hook?


sleepygiant
01-23-2012, 11:40 PM
Hi Everyone,
I apologize if this is located within any thread or guide. I tried searching for the hook list, and found the 4.1 list-- but nothing helpful.

I would like to intercept a post and pass it to a PHP script that does some checking against an API.

In wordpress, it's the preprocess_comment hook, but I can't find the proper hook in vbulletin.

Any help would be appreciated!

john

kh99
01-23-2012, 11:50 PM
Maybe newpost_process will work for you - the post text will be in $post['message']. If you want, your plugin can add a string to the $errors array and it will stop posting of the message and display your error above the editor. (Look in includes/functions_newpost.php if you're interested in seeing where the hook code is executed).

sleepygiant
01-24-2012, 05:22 PM
Hi KH99,
I wanted to take a moment to thank you. I was able to use that hook, and implement my plugin and it works flawlessly.

Thank you!

sleepygiant
07-20-2012, 06:56 PM
Hi all,
I know some forums hate bumping threads, and I dont' know if this qualifies, but I've discovered that intercept works for new posts but not editing posts

It seems that $post['message']; is different when updating/editing a thread. I looked within functions, but since the search term is very broad, I can't narrow it down.

Does anyone have any insight into what it is for editing posts?

kh99
07-20-2012, 07:13 PM
The easiest thing to do is probably to make another plugin using hook editpost_update_process. Check the message test in $edit['message'] and if there's an error, add a string to $dataman->errors[].