Changeset 13956
- Timestamp:
- 07/09/2024 01:16:26 AM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/14.0/src/bp-core/admin/bp-core-admin-functions.php
r13946 r13956 985 985 * 986 986 * @since 1.7.0 987 * @since 14.0.0 Added 'bp_admin_separator' filter. 988 * 989 * @global array $menu 987 990 */ 988 991 function bp_admin_separator() { 989 992 990 // Bail if BuddyPress is not network activated and viewing network admin. 993 // Default to always adding 994 $add = true; 995 996 // Skip if BuddyPress is not network activated and viewing network admin. 991 997 if ( is_network_admin() && ! bp_is_network_activated() ) { 992 return;993 } 994 995 // Bailif BuddyPress is network activated and viewing site admin.998 $add = false; 999 } 1000 1001 // Skip if BuddyPress is network activated and viewing site admin. 996 1002 if ( ! is_network_admin() && bp_is_network_activated() ) { 997 return;1003 $add = false; 998 1004 } 999 1005 1000 1006 // Prevent duplicate separators when no core menu items exist. 1001 1007 if ( ! bp_current_user_can( 'bp_moderate' ) ) { 1008 $add = false; 1009 } 1010 1011 // Bail if there are no components with admin UI's. 1012 if ( ! bp_is_active( 'activity' ) && ! bp_is_active( 'groups' ) ) { 1013 $add = false; 1014 } 1015 1016 // Force on Site Admin if BuddyPress Core post-types are registered 1017 if ( is_blog_admin() && bp_current_user_can( 'bp_moderate' ) ) { 1018 1019 // See: BP_Core::register_post_types() 1020 if ( post_type_exists( bp_get_email_post_type() ) || post_type_exists( 'buddypress' ) ) { 1021 $add = true; 1022 } 1023 } 1024 1025 /** 1026 * Filters whether a top-level admin menu separator is added. 1027 * 1028 * @since 14.0.0 1029 * 1030 * @param bool $add Default true. May be false if nothing to separate. 1031 */ 1032 $add = (bool) apply_filters( 'bp_admin_separator', $add ); 1033 1034 // Bail if a separator is not necessary 1035 if ( false === $add ) { 1002 1036 return; 1003 1037 } 1004 1038 1005 // Bail if there are no components with admin UI's. Hardcoded for now, until1006 // there's a real API for determining this later.1007 if ( ! bp_is_active( 'activity' ) && ! bp_is_active( 'groups' ) ) {1008 return;1009 }1010 1011 1039 global $menu; 1012 1040 1041 // Append a separator to the end of the global menu array 1013 1042 $menu[] = array( '', 'read', 'separator-buddypress', '', 'wp-menu-separator buddypress' ); 1014 1043 }
Note: See TracChangeset
for help on using the changeset viewer.