Site in read-only mode

This site is now read-only following the release of MyBB 1.8 and the new mods site.

If you are looking for MyBB 1.8 mods please click here to visit the new mods site.

You can continue to download submissions for MyBB 1.6 and earlier here, however new submissions will only be accepted via the new mods site.


A collection of useful functions for other plugins.

Version: 12
Author: frostschutz
Submitted: 29th January 2011
Last Updated: 14th July 2013
Please see Extend MyBB for PluginLibrary >= 13 for MyBB 1.8:

PluginLibrary is not a stand-alone plugin, but rather a library of useful functions that can be used by plugins and plugin developers. For example, it can help you manage settings of your plugin, or apply edits to core files. The list of PluginLibrary's features is expected to grow over time and contributions are welcome.

PluginLibrary is Open Source Software, licensed under the GNU Lesser General Public License, Version 3. This is the same license as MyBB itself uses, so if you can use MyBB, you should also be able to use PluginLibrary.

PluginLibrary is Copyright © 2011 Andreas Klauer ([email protected])

Function overview:

  • settings()
    This function creates a setting group and a list of settings. If the setting group already exists, the settings inside this group will be updated to their new names and descriptions, while keeping their custom values intact. Settings that no longer exist will be removed. Optionally, it also generates a language file for your settings.
  • settings_delete()
    This function deletes one (or more) setting groups and settings.
  • templates()
    Create a template group and list of templates. If the group already exists, the templates will be added/updated/removed depending on whether a template is new/changed/no longer in use. User edited versions of updated templates will show up in MyBB's "Find Updated Templates" feature.
  • templates_delete()
    Deletes one (or more) template groups and their templates.
  • stylesheet()
    This function creates/updates/activates a stylesheet in the MyBB Master Style. It will be inherited by all themes, enabling the user to edit and revert like the official stylesheets.
  • stylesheet_delete()
    Delete one or more stylesheets.
  • stylesheet_deactivate()
    Deactivate one or more stylesheet without losing user edits.
  • cache_read()
    This function reads an on-demand cache and returns its value (if present). Note that on-demand cache is allowed to vanish any time.
  • cache_update()
    This function creates or updates an on-demand cache with contents. Unlike MyBB's built-in $cache, it does not use the database nor does it load the cache automatically. Instead it uses a more specialized cache handler (by default: disk) directly, and you have to load the cache on demand using $PL->cache_read().
  • cache_delete()
    This function safely deletes one (or more) caches.
  • edit_core()
    This function makes, updates, and undoes simple, line based changes to PHP/JS/CSS files. Using search patterns, it locates blocks of one or more lines of code, and inserts new code before or after them, or replaces them.
  • is_member()
    This function checks if a user is member of one or more groups. Useful if your plugin has a setting to include/exclude one or more groups.
  • url_append()
    Append one or more query parameters to an URL that may or may not have an existing ?query. The parameters will be encoded properly.
  • xml_export()
    Export arbitrary data as XML.
  • xml_import()
    Import previously exported data from XML.

The full developer documentation and a sample plugin is included in the package.