API/functions/bb admin add menu

From bbPulp

Jump to: navigation, search
Function
bb_admin_add_menu
File: /bb-admin/admin-functions.php
Class: none
Pluggable: no
Introduced: 1.0alpha - revision 794
Deprecated: no

[edit] Description

void bb_admin_add_menu ( string $display_name, string $capability, string $file_name )

Adds a menu item to the administration area. The item appears in the top row of the default layout.

Note: this function is of little use without a subsequent call to it's sister function, bb_admin_add_submenu.

[edit] Parameters

display_name
The text that will display in the menu.
capability
The capability that the viewer must possess to be able to view the menu item.
file_name
The filename of the page being linked to within the /bb-admin directory, or the value to be passed to the "plugin" variable on /bb-admin/admin-base.php

[edit] Examples

Example 1: Add two submenu items to a new menu item

bb_admin_add_menu(__('My plugins'), 'use_keys', 'myplugin_admin_page');
bb_admin_add_submenu(__('My plugin'), 'use_keys', 'myplugin_admin_page', 'myplugin_admin_page');
bb_admin_add_submenu(__('My other plugin'), 'use_keys', 'myotherplugin_admin_page', 'myplugin_admin_page');
Personal tools