MyBB Community Forums

Full Version: Functions to use for plugins?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I think some people have used/talked about a few functions that one can use when activating/deactivating a plugin. Stuff to update templates being the main one. If these sort of functions exist, where are they and is there a list?

I feel such a noob asking questions like this.
to update a template, you need to add
require "./inc/adminfunctions_templates.php"; //I'm pretty sure that's the filename. I'm not home right now, but that should be it.

find_replace_templatesets("templatename","string to find"/*as if you would search with preg_replace(), so use \[ and \] if needed*/, "replacement", 0/*only add this 0 if you do not wish to create a new template. recommended for deactivating the plugin*/);
To create a template and then remove it when deactivating, you need to use a $db->query (don't forget global $db; )
I don't know if there is a function for that. But if it exists, it is defined in the adminfunctions_templates.php file.
I don't know of any other functions right now.