bp_core_admin_backpat_menu

In BP 1.6, the top-level admin menu was removed.

Description

bp_core_admin_backpat_menu(); 

For backpat, this function keeps the top-level menu if a plugin has registered a menu into the old 'bp-general-settings' menu.

The old bp-general-settings page was renamed bp-components..


Usage

  1. if ( !function_exists( 'bp_core_admin_backpat_menu' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/admin/bp-core-admin-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_core_admin_backpat_menu(); 
  7.  

Defined (1)

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

/bp-core/admin/bp-core-admin-functions.php  
  1. function bp_core_admin_backpat_menu() { 
  2. global $_parent_pages, $_registered_pages, $submenu; 
  3.  
  4. // If there's no bp-general-settings menu (perhaps because the current 
  5. // user is not an Administrator), there's nothing to do here. 
  6. if ( ! isset( $submenu['bp-general-settings'] ) ) { 
  7. return; 
  8.  
  9. /** 
  10. * By default, only the core "Help" submenu is added under the top-level BuddyPress menu. 
  11. * This means that if no third-party plugins have registered their admin pages into the 
  12. * 'bp-general-settings' menu, it will only contain one item. Kill it. 
  13. */ 
  14. if ( 1 != count( $submenu['bp-general-settings'] ) ) { 
  15. return; 
  16.  
  17. // This removes the top-level menu. 
  18. remove_submenu_page( 'bp-general-settings', 'bp-general-settings' ); 
  19. remove_menu_page( 'bp-general-settings' ); 
  20.  
  21. // These stop people accessing the URL directly. 
  22. unset( $_parent_pages['bp-general-settings'] ); 
  23. unset( $_registered_pages['toplevel_page_bp-general-settings'] );