bp_core_add_admin_menu_page

In BuddyPress 1.1 - 1.2.x, this function provided a better version of add_menu_page() that allowed positioning of menus.

Description

(string) bp_core_add_admin_menu_page( (string) $args = '' ); 

Deprecated in 1.5 in favour of a WP core function.

Returns (string)

Parameters (1)

0. $args — Optional. (string) => ''
The args.

Usage

  1. if ( !function_exists( 'bp_core_add_admin_menu_page' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/deprecated/1.5.php'; 
  3.  
  4. // The args. 
  5. $args = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_core_add_admin_menu_page($args); 
  9.  

Defined (1)

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

/bp-core/deprecated/1.5.php  
  1. function bp_core_add_admin_menu_page( $args = '' ) { 
  2. global $_registered_pages, $admin_page_hooks, $menu; 
  3.  
  4. _deprecated_function( __FUNCTION__, '1.5', 'Use add_menu_page()' ); 
  5.  
  6. $defaults = array( 
  7. 'access_level' => 2,  
  8. 'file' => false,  
  9. 'function' => false,  
  10. 'icon_url' => false,  
  11. 'menu_title' => '',  
  12. 'page_title' => '',  
  13. 'position' => 100 
  14. ); 
  15.  
  16. $r = wp_parse_args( $args, $defaults ); 
  17. extract( $r, EXTR_SKIP ); 
  18.  
  19. $file = plugin_basename( $file ); 
  20. $hookname = get_plugin_page_hookname( $file, '' ); 
  21.  
  22. $admin_page_hooks[$file] = sanitize_title( $menu_title ); 
  23.  
  24. if ( !empty( $function ) && !empty ( $hookname ) ) 
  25. add_action( $hookname, $function ); 
  26.  
  27. if ( empty( $icon_url ) ) 
  28. $icon_url = 'images/generic.png'; 
  29. elseif ( is_ssl() && 0 === strpos( $icon_url, 'http://' ) ) 
  30. $icon_url = 'https://' . substr( $icon_url, 7 ); 
  31.  
  32. do { 
  33. $position++; 
  34. } while ( !empty( $menu[$position] ) ); 
  35.  
  36. $menu[$position] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url ); 
  37. $_registered_pages[$hookname] = true; 
  38.  
  39. return $hookname;