Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Building Forums With vBulletin (2006).pdf
Скачиваний:
40
Добавлен:
17.08.2013
Размер:
6.3 Mб
Скачать

Developing a Hack

Plugins and Products

One of the new features available in vBulletin 3.5 is plugins and products. Plugins and products are a new and easy way to add new features to a vBulletin installation.

There are some differences between a plugin and a product. A plugin allows new features to be added to a core vBuletin installation. In other words, it is a code snippet imported into vBulletin and executed by specific hooks. This is an easy way to extend functionality without making changes to the underlying PHP files of vBulletin.

A product is a downloadable package that contains notonly plugins but also templates, options, phrases, help files, and control panel entries. This means that these are a bigger, more integrated types of plugins.

Hooks are what drives plugins. These are locations within the PHP code of vBulletin that trigger events. These events can be used to run code contained in plugins. You can view these hooks from the AdminCP by clicking on Plugin System followed by Add New Plugin, and then clicking on the Hook Location drop-down box.

Getting Plugins and Products

Plenty of plugins and products that are designed to carry out a multitude of tasks are available for download. In fact, many hacks and board modifications have been converted to plugins and products because of the ease of installation.

The best place to begin your search for plugins is http://www.vbulletin.org.

174

Chapter 8

Adding a Product

After you have downloaded a product (which will be an XML file), access AdminCP and click on

Plugin System followed by Manage Products. From here click on Add/Import Product:

This will take you to the Import Product screen:

Using this, you can choose to import the plugin either from your computer (by uploading it to the server) or import the XML file from your server. One you have found the file, click Import. This will import the plugin into vBulletin and activate it and make it ready for use.

After you have installed the plugin, make sure to follow any additional installation instructions provided with the plugin.

Adding a Plugin

Adding a plugin to a vBulletin installation is much easier. From the AdminCP, click on Plugin System followed by Add New Plugin.

175

Developing a Hack

In this screen you can cut and paste the code from the instructions you have, and choose the necessary hook to execute the plugin.

After making all the changes, click on Save, and the plugin will be added to vBulletin and be ready to use.

What If Things Go Wrong?

Whenever you add any new code to a vBulletin installation, there is a chance that things may go wrong. The worst-case scenario is that you bring down the whole vBulletin board and make it totally inaccessible.

Fortunately, there's a global way to disable plugins, and it doesn't require access to the vBulleting interface, only FTP access to the server.

All you need to do is find the includes/config.php file and add the following code:

Define('DISABLE_HOOKS', true);

Save the file and upload it to the server. Now vBulletin will run without plugins, and this gives you a chance to remove the offending product or plugin using Manage Products or Manage Plugins from the AdminCP.

Once you have removed the offending plugin, you can reactivate the plugin system by removing that line of code from includes/config.php.

176