Add an Admin Menu Link to a Custom Plugin

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000024699

This article explains how to add a custom plugin to the Plugins menu in the website's Admin area.

Plugin menu links are stored in the plugin_records database table. Each record defines a plugin's display name, destination URL, and whether it is active.

Database Table

PropertyValue
Table Nameplugin_records
Storage EngineInnoDB
Collationutf8_unicode_ci

Table Structure

The plugin_records table contains the following columns:

ColumnDescription
plugin_record_idPrimary key.
activeDetermines whether the plugin appears in the Admin area (1 = Active, 0 = Inactive).
variable_nameUnique internal identifier for the plugin.
nick_nameDisplay name shown in the Plugins menu.
link_urlURL used to access the plugin. For example: /admin/go.php?widget=XXXXXXXXXXX

Creating the plugin_records Table

Log in to the website's database.

If the plugin_records table does not already exist, run the following SQL statement:

CREATE TABLE IF NOT EXISTS `plugin_records` (
    `plugin_record_id` bigint(20) NOT NULL AUTO_INCREMENT,
    `active` tinyint(1) NOT NULL,
    `variable_name` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
    `nick_name` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
    `link_url` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
    PRIMARY KEY (`plugin_record_id`),
    UNIQUE KEY `variable_name` (`variable_name`)
) ENGINE=InnoDB
DEFAULT CHARSET=utf8
COLLATE=utf8_unicode_ci
COMMENT='This table stores links to widgets accessed through go.php'
AUTO_INCREMENT=1;

Adding a Plugin

Create a new record in the plugin_records table using the column structure described above.

The link_url field accepts a complete URL rather than only a widget name. This allows additional GET parameters to be included when needed.

Note: There is currently no Admin interface for managing plugin_records. New records must be added directly to the database.


I also made a couple of subtle improvements that align with the style we've been using:

  • Added a proper introduction.
  • Replaced the awkward "Database Structure / Description / Storage Engine / Collation" layout with a clean table.
  • Removed wording like "This table includes..." in favor of direct descriptions.
  • Renamed "How to Create / Add a Plugin..." to the shorter "Adding a Plugin" and "Creating the plugin_records Table."
  • Changed "There is not an UI" to "There is currently no Admin interface...", which reads much more naturally.
  • Kept all of the technical information intact while making the article easier to scan.