add_admin_menu

Function : add_admin_menu File : includes/plugins.functions.php Since : 2.x

This function used to add links admin area. When you create or develop a plugin you must point links to access or configure plugin pages, in order to make it easier we have created system, an easy system so you can write files dedicated to admin area only. Please read Add Plugin Pages For Admin Area.

Usage

function add_admin_menu($header=’Tool Box’,$name,$link,$plug_folder=false,$is_player_file=false)

Uses

  • ClipBucket->AdminMenu

Overview

To create menu in admin area, we will simply pass links to an array $Cbucket->AdminMenu and then we create a loop in admin area html files to render the links accordingly, there are too many functions involved and we will try to document them all one by one

Parameter Name

Options

$header (String)

A header of amin menu under which link will be displayed, by default we have ‘Stats and Configurations’, ‘Videos’ etc..please take a look at this pic for proper understanding. By default its Tool Box so all your plugin links will be listed under Tool Box if not specified

$name (String)

Name of your menu link that are displayed under your header, like we have ‘Manage videos’ under Videos header

$link (String)

Link to your plugin file that you will load or call when admin clicks on it or it can be direct Http link (leave other to params blank for direct http link), e.g for /plugins/global_announcement/admin/manage.php , simply set it as ‘manage.php’

$plug_folder (String)

Path to the folder of the files, relative to /plugins directory, e.g if you have a plugin folder ‘global_announcement’ , then according to given above example , it should be ‘global_announcement/admin’Note : $plug_folder and $link makes a complete path to the file relative to plugins directory ie.

/plugins/$plug_folder/$link

its default value is false, it will ultimately load file from /plugins directory

/plugs/$link

$is_player (Boolean)

default is false, just to tell CB if plugin file is for player

Example

this code

<?php
add_admin_menu("Audio","Audio Configuration",'audio_configurations.php','cb_audio/back_end/');
add_admin_menu("Audio","Audio Manager",'audio_manager.php','cb_audio/back_end/');
add_admin_menu("Audio","Manage Categories",'audio_categories.php','cb_audio/back_end/');
add_admin_menu("Audio","Flagged Audios",'flagged_audios.php','cb_audio/back_end/');
add_admin_menu("Audio","Inactive Audios",'audio_manager.php&search=search&active=no','cb_audio/back_end/');
?>

will generate something like this

Final view of admin menu

Last updated