MyBB Community Forums

Full Version: Help with permanent replacement in database from mycode
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Okay I have successfully searched, parsed and displayed what I want for the mycode [roll=6]4[/roll]

However I it refreshes every time you open the thread, that is not what I intended. I've managed two separate ways to do this but neither of them actually change the database.

What I'm looking to do is parse the message BEFORE it is saved in the database and make the replacement.

Is there a hook that does that? am I missing it?

Just a small fyi, this is my first plugin so I'm a bit lost.

Yes, this sort of thing must be parsed before (and not on-demand), however, this is probably a lot more difficult than you think (assuming you don't want users to fake the random numbers).

To answer your question, try the datahandler_post_insert_post in inc/datahandlers/post.php (might also be interested in the edit post hook: datahandler_post_update)
Right now I'm basing this version of the plugin on the honor system. Once I get more of a knowledge base of the plugins under me I will tackle that part.

Thanks for the help I will look into those ... I actually saw that after I had posted, go figure.

Thank you Zinga very much for your help I have gotten it to work in reply's only. is an example of what it's doing.

To get it to work in a new thread I would use: