Ticket #9184: 9184.diff
File 9184.diff, 2.3 KB (added by , 10 months ago) |
---|
-
src/bp-core/admin/bp-core-admin-functions.php
26 26 * 27 27 * The old "bp-general-settings" page was renamed "bp-components". 28 28 * 29 * @since 1.6.0 29 * @since 1.6.0 30 30 * 31 31 * @global array $_parent_pages 32 32 * @global array $_registered_pages … … 953 953 * Add a separator to the WordPress admin menus. 954 954 * 955 955 * @since 1.7.0 956 * @since 12.6.0 Added 'bp_admin_separator' filter. 957 * 958 * @global array $menu 956 959 */ 957 960 function bp_admin_separator() { 958 961 959 // Bail if BuddyPress is not network activated and viewing network admin. 962 // Default to always adding 963 $add = true; 964 965 // Skip if BuddyPress is not network activated and viewing network admin. 960 966 if ( is_network_admin() && ! bp_is_network_activated() ) { 961 return;967 $add = false; 962 968 } 963 969 964 // Bailif BuddyPress is network activated and viewing site admin.970 // Skip if BuddyPress is network activated and viewing site admin. 965 971 if ( ! is_network_admin() && bp_is_network_activated() ) { 966 return;972 $add = false; 967 973 } 968 974 969 975 // Prevent duplicate separators when no core menu items exist. 970 976 if ( ! bp_current_user_can( 'bp_moderate' ) ) { 971 return;977 $add = false; 972 978 } 973 979 974 // Bail if there are no components with admin UI's. Hardcoded for now, until 975 // there's a real API for determining this later. 980 // Bail if there are no components with admin UI's. 976 981 if ( ! bp_is_active( 'activity' ) && ! bp_is_active( 'groups' ) ) { 982 $add = false; 983 } 984 985 // Force on Site Admin if BuddyPress Core post-types are registered 986 if ( is_blog_admin() && bp_current_user_can( 'bp_moderate' ) ) { 987 988 // See: BP_Core::register_post_types() 989 if ( post_type_exists( bp_get_email_post_type() ) || post_type_exists( 'buddypress' ) ) { 990 $add = true; 991 } 992 } 993 994 /** 995 * Filters whether a top-level admin menu separator is added. 996 * 997 * @since 12.6.0 998 * 999 * @param bool $add Default true. May be false if nothing to separate. 1000 */ 1001 $add = (bool) apply_filters( 'bp_admin_separator', $add ); 1002 1003 // Bail if a separator is not necessary 1004 if ( false === $add ) { 977 1005 return; 978 1006 } 979 1007 980 1008 global $menu; 981 1009 1010 // Append a separator to the end of the global menu array 982 1011 $menu[] = array( '', 'read', 'separator-buddypress', '', 'wp-menu-separator buddypress' ); 983 1012 }