bb_admin_add_submenu

The BuddyPress bb admin add submenu function.

Description

bb_admin_add_submenu( (string) $display_name, $capability, (string) $file_name, (string) $parent = 'plugins.php' ); 

Parameters (4)

0. $display_name (string)
The display name.
1. $capability
The capability.
2. $file_name (string)
The file name.
3. $parent — Optional. (string) => 'plugins.php'
The parent.

Usage

  1. if ( !function_exists( 'bb_admin_add_submenu' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php'; 
  3.  
  4. // The display name. 
  5. $display_name = ''; 
  6.  
  7. // The capability. 
  8. $capability = null; 
  9.  
  10. // The file name. 
  11. $file_name = ''; 
  12.  
  13. // The parent. 
  14. $parent = 'plugins.php'; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = bb_admin_add_submenu($display_name, $capability, $file_name, $parent); 
  18.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php  
  1. function bb_admin_add_submenu( $display_name, $capability, $file_name, $parent = 'plugins.php' ) 
  2. global $bb_submenu; 
  3. global $bb_registered_plugin_callbacks; 
  4. if ( empty( $bb_registered_plugin_callbacks ) ) { 
  5. $bb_registered_plugin_callbacks = array(); 
  6.  
  7. if ( $display_name && $capability && $file_name ) { 
  8. if ( strpos( $file_name, '.php' ) === false ) { 
  9. $bb_registered_plugin_callbacks[] = $file_name; 
  10. $bb_submenu[$parent][] = array( $display_name, $capability, $file_name ); 
  11. ksort( $bb_submenu );