Changeset 6676
- Timestamp:
- 12/26/2012 03:47:11 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-admin.php
r6609 r6676 45 45 } 46 46 add_action( bp_core_admin_hook(), 'bp_activity_add_admin_menu' ); 47 48 /** 49 * Add activity component to custom menus array 50 * 51 * @since BuddyPress (1.7) 52 * 53 * @param array $custom_menus 54 * @return array 55 */ 56 function bp_activity_admin_menu_order( $custom_menus = array() ) { 57 array_push( $custom_menus, 'bp-activity' ); 58 return $custom_menus; 59 } 60 add_filter( 'bp_admin_menu_order', 'bp_activity_admin_menu_order' ); 47 61 48 62 /** -
trunk/bp-core/admin/bp-core-actions.php
r6558 r6676 44 44 add_action( 'admin_notices', 'bp_admin_notices' ); 45 45 add_action( 'admin_enqueue_scripts', 'bp_admin_enqueue_scripts' ); 46 add_action( 'network_admin_menu', 'bp_admin_menu' ); 47 add_action( 'custom_menu_order', 'bp_admin_custom_menu_order' ); 48 add_action( 'menu_order', 'bp_admin_menu_order' ); 46 49 add_action( 'wpmu_new_blog', 'bp_new_site', 10, 6 ); 47 50 … … 53 56 add_action( 'bp_admin_init', 'bp_do_activation_redirect', 1 ); 54 57 55 // Reset the menu order56 //add_action( 'bp_admin_menu', 'bp_admin_separator' );58 // Add a new separator 59 add_action( 'bp_admin_menu', 'bp_admin_separator' ); 57 60 58 61 /** -
trunk/bp-core/admin/bp-core-functions.php
r6632 r6676 361 361 } 362 362 } 363 364 /** Separator *****************************************************************/ 365 366 /** 367 * Add a separator to the WordPress admin menus 368 * 369 * @since BuddyPress (1.7) 370 * 371 * @uses bp_current_user_can() To check users capability on root blog 372 */ 373 function bp_admin_separator() { 374 375 // Prevent duplicate separators when no core menu items exist 376 if ( ! bp_current_user_can( 'bp_moderate' ) ) 377 return; 378 379 global $menu; 380 381 $menu[] = array( '', 'read', 'separator-buddypress', '', 'wp-menu-separator buddypress' ); 382 } 383 384 /** 385 * Tell WordPress we have a custom menu order 386 * 387 * @since BuddyPress (1.7) 388 * 389 * @param bool $menu_order Menu order 390 * @uses bp_current_user_can() To check users capability on root blog 391 * @return bool Always true 392 */ 393 function bp_admin_custom_menu_order( $menu_order = false ) { 394 395 // Bail if user cannot see admin pages 396 if ( ! bp_current_user_can( 'bp_moderate' ) ) 397 return $menu_order; 398 399 return $menu_order; 400 } 401 402 /** 403 * Move our custom separator above our custom post types 404 * 405 * @since BuddyPress (1.7) 406 * 407 * @param array $menu_order Menu Order 408 * @uses bp_current_user_can() To check users capability on root blog 409 * @return array Modified menu order 410 */ 411 function bp_admin_menu_order( $menu_order = array() ) { 412 413 // Bail if user cannot see admin pages 414 if ( empty( $menu_order ) || ! bp_current_user_can( 'bp_moderate' ) ) 415 return $menu_order; 416 417 // Initialize our custom order array 418 $bp_menu_order = array(); 419 420 // Menu values 421 $last_sep = is_network_admin() ? 'separator1' : 'separator2'; 422 423 // Filter the custom admin menus 424 $custom_menus = (array) apply_filters( 'bp_admin_menu_order', array() ); 425 426 // Add our separator to beginning of array 427 array_unshift( $custom_menus, 'separator-buddypress' ); 428 429 // Loop through menu order and do some rearranging 430 foreach ( (array) $menu_order as $item ) { 431 432 // Position BuddyPress menus above appearance 433 if ( $last_sep == $item ) { 434 435 // Add our custom menus 436 foreach( (array) $custom_menus as $custom_menu ) { 437 if ( array_search( $custom_menu, $menu_order ) ) { 438 $bp_menu_order[] = $custom_menu; 439 } 440 } 441 442 // Add the appearance separator 443 $bp_menu_order[] = $last_sep; 444 445 // Skip our menu items 446 } elseif ( ! in_array( $item, $custom_menus ) ) { 447 $bp_menu_order[] = $item; 448 } 449 } 450 451 // Return our custom order 452 return $bp_menu_order; 453 } -
trunk/bp-groups/bp-groups-admin.php
r6674 r6676 45 45 } 46 46 add_action( bp_core_admin_hook(), 'bp_groups_add_admin_menu' ); 47 48 /** 49 * Add groups component to custom menus array 50 * 51 * @since BuddyPress (1.7) 52 * 53 * @param array $custom_menus 54 * @return array 55 */ 56 function bp_groups_admin_menu_order( $custom_menus = array() ) { 57 array_push( $custom_menus, 'bp-groups' ); 58 return $custom_menus; 59 } 60 add_filter( 'bp_admin_menu_order', 'bp_groups_admin_menu_order' ); 47 61 48 62 /**
Note: See TracChangeset
for help on using the changeset viewer.