|
[TUTORIAL] How to make a plugin.
|
|
Mar 10, 2007, 04:18 PM
Post: #1
|
|||
|
|||
|
[TUTORIAL] How to make a plugin.
You should start off with the basic plugin template.
Notations are in BLUE and need to be removed from final plugin product RED text is areas that you will replace with your own information and variable for the plugin Quote:// The information that shows up on the plugin manager This is explained well at the mybb wiki here: http://wiki.mybboard.net/index.php/Authoring_Plugins What is not explained well is exactly HOW to use the hooks and create a functioning plugin. To add an admin setting to your plugin you first need to add a query array to your activation function. Something like this is used to first create the "Settings Group" Quote: require "../inc/adminfunctions_templates.php"; (note the 88 is display order and you should create a number somewhere between 30 and 250 as sometimes mybb has a conflict here and a setting won't be displayed because of this) Next the actual settings within the group are added to your activation function. Quote: $PLUGINNAME_setting_1 = array( In the above example the first setting is an "enable/disable" query. The second is a setting for the plugin. Both of these I will explain how to use in a function. But first let's finish off the deactivation part of your plugin. Quote: require '../inc/adminfunctions_templates.php'; At this point your plugin will look like this: Quote:// The information that shows up on the plugin manager CLICK HERE to find out more about a custom theme design for mybb. |
|||
|
Mar 10, 2007, 04:40 PM
Post: #2
|
|||
|
|||
|
RE: [TUTORIAL] How to make a plugin.
Next we will look into our hooks and functions.
Near the top of our file we are going to add an addhook line. Quote:$plugins->add_hook("HOOK NAME", "FUNCTION NAME"); A list of hooks are available here (not complete list as it's old version): http://wiki.mybboard.net/index.php/MyBB_Plugin_Hooks You can also look within a file you wish to manipulate such as showthread.php and search for "hooks" and you will see them named such as Quote:$plugins->run_hooks("showthread_start");So at that moment in the showthread.php it will look for any hook running as showthread_start. Some other important hook name might be these: admin_global_start pre_output_page postbit Next let's add the function to match with your hook after the activate and deactivate functions. Quote:// Functions Next we should add our php tags to beginning and end of file. So now our plugin should like like this: Quote:<?php At this point you have an actual plugin sadly it doesn't do anything. That's next. CLICK HERE to find out more about a custom theme design for mybb. |
|||
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads... | |||||
| Thread: | Author | Replies: | Views: | Last Post | |
| PM to admin plugin | daz25 | 2 | 205 |
Oct 28, 2008 11:14 AM Last Post: daz25 |
|
| need some help with plugin =D | daav2008 | 2 | 118 |
Oct 25, 2008 03:07 PM Last Post: daav2008 |
|
| another plugin,another error LOL | ed123 | 14 | 380 |
Oct 01, 2008 03:32 PM Last Post: ed123 |
|
| Who made this plugin? | sadiqsaad | 5 | 186 |
Oct 01, 2008 12:30 PM Last Post: sadiqsaad |
|
| [Request] Clubs/Communities Plugin | Violation | 3 | 375 |
Mar 22, 2008 12:43 PM Last Post: judel |
|

Upgrade
Invite
Documents
Search
Member List
Calendar
Help
Tagpad


