|
[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 |
|||
|
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. |
|||
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads... | |||||
| Thread: | Author | Replies: | Views: | Last Post | |
| What is the plugin on the side of mybbcentral? | The Social Engineer | 2 | 50 |
May 10, 2012 06:51 PM Last Post: BleepyEvans |
|
| Plugin like vbseo | alex20_2008 | 1 | 58 |
Apr 23, 2012 03:13 PM Last Post: Mr.Kewl |
|
| Plugin Help | Capito | 8 | 104 |
Apr 22, 2012 12:51 PM Last Post: Capito |
|
| What plugin is that? | Natha | 0 | 36 |
Apr 07, 2012 06:02 AM Last Post: Natha |
|
| How to make 1.4 Plugins work with 1.6 | Natha | 1 | 433 |
Apr 06, 2012 10:01 PM Last Post: Natha |
|
User(s) browsing this thread: 1 Guest(s)

Upgrade
Search
Member List
Calendar
Contact
Help
Tagpad


