Listed in topics: Developers, Documentation
Plugin Resources »Writing a Plugin
IntenseDebate Plugins allow easy modification, customization, and enhancement to the IntenseDebate comment system. You might not be able to change the core programming of IntenseDebate, but now you can add functionality with IntenseDebate Plugins. (Note: IntenseDebate Plugins are modeled after WordPress Plugins API, so if you’re already familiar with those you’ll feel right at home. If not, no worries…we document it all here.) Here is a basic definition:
Longing for some new or modified functionality in IntenseDebate? The first thing to do is to check if someone has already created an IntenseDebate Plugin that suits your needs. If not, this article will guide you through the process of creating your own IntenseDebate Plugins.
Resources↑ Table of Contents ↑
- To understand how IntenseDebate Plugins work and how to install them on your IntenseDebate enabled blog, see Plugins.
- To learn the basics about how IntenseDebate Plugins are written, view the source code for some example Plugins, such as YouTube Embeds on the Plugin Examples page.
- Once you have written your IntenseDebate Plugin, read Submitting a Plugin to learn how to add it to the plugin directory and share it with others.
Creating a Plugin↑ Table of Contents ↑
This section of the article goes through the steps you need to follow, and things to consider when creating a well-structured IntenseDebate Plugin.
Plugin Name ↑ Table of Contents ↑
The first task in creating an IntenseDebate Plugin is to think about what the Plugin will do, and make a (hopefully unique) name for your Plugin. Check out our Plugins list to verify that your name is unique; you might also do a Google search on your proposed name. Most Plugin developers choose to use names that somewhat describe what the Plugin does; for instance, a weather-related Plugin would probably have the word “weather” in the name. The name can be multiple words.
Home Page ↑ Table of Contents ↑
It is also very useful to create a web page to act as the home page for your IntenseDebate Plugin. This page should describe the Plugin, what it does, what has changed from version to version of your Plugin, and how to use the Plugin.
Programming Your Plugin↑ Table of Contents ↑
Now, it’s time to make your Plugin actually do something. This section contains some general ideas about Plugin development, and describes how to accomplish several tasks your Plugin will need to do.
IntenseDebate Plugin Hooks↑ Table of Contents ↑
Many WordPress Plugins accomplish their goals by connecting to one or more IntenseDebate Plugin “hooks”. The way Plugin hooks work is that at various times while IntenseDebate is running, IntenseDebate checks to see if any Plugins have registered functions to run at that time, and if so, the functions are run. These functions modify the default behavior of IntenseDebate.
For instance, while IntenseDebate is rendering the comments, it first checks to see if any Plugin has registered a function for the “filter” hook called “comment_text_load”. If so, the comment text for each comment is passed in turn through each registered function, and the final result is what is output. So, if your Plugin needs to add/modify some information in the comment body, it can register a “comment_text_load” filter function.
Another example is the “action” hook called “comment_post”. Just after a comment is posted it checks to see whether any Plugins have registered functions for the “comment_post” action hook, and runs them in turn.
You can learn more about how to register functions for both filter and action hooks, and what Plugin hooks are available in IntenseDebate, in the Plugin API. If you find a spot in the IntenseDebate code where you’d like to have an action or filter, but IntenseDebate doesn’t have one, you can also suggest new hooks (suggestions will generally be taken).
Plugin Development Suggestions↑ Table of Contents ↑
This last section contains some random suggestions regarding Plugin development.
- Try to keep as much of the code inside the plugin as possible (as opposed to in external script requests). The overhead for extra HTTP requests can get expensive.
Last modified: July 27, 2010 by Michael