12-18-2009, 04:50 PM
The thing that took me a while to grasp was hooks. This is how you use them:
Unsurprisingly, global_start is a hook run near the start of global.php... basically when global.php is run it runs the global_start hook, and find all plugins that use that hook. Then, in the plugins that use it, it just runs the function with the name you specified in the code above. So, here, it would look for a function called plugin_name and just run it whenever the global_start hook is run. There's a list of hooks here. Adding templates/settings is easy and you can pretty much copy that from other plugins, there's only really one way of doing those.
PHP Code:
$plugins->add_hook('global_start', 'plugin_name');
Unsurprisingly, global_start is a hook run near the start of global.php... basically when global.php is run it runs the global_start hook, and find all plugins that use that hook. Then, in the plugins that use it, it just runs the function with the name you specified in the code above. So, here, it would look for a function called plugin_name and just run it whenever the global_start hook is run. There's a list of hooks here. Adding templates/settings is easy and you can pretty much copy that from other plugins, there's only really one way of doing those.
MyBB Support Team Lead