Changeset 12730
- Timestamp:
- 09/21/2020 01:29:06 AM (4 years ago)
- Location:
- trunk/src
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-admin.php
r12725 r12730 175 175 // BuddyPress Hello. 176 176 add_action( 'admin_footer', array( $this, 'about_screen' ) ); 177 178 // BuddyPress Types administration. 179 add_action( 'load-edit-tags.php', array( 'BP_Admin_Types', 'register_types_admin' ) ); 177 180 178 181 /* Filters ***********************************************************/ -
trunk/src/bp-members/bp-members-admin.php
r11360 r12730 13 13 // Load the BP Members admin. 14 14 add_action( 'bp_init', array( 'BP_Members_Admin', 'register_members_admin' ) ); 15 16 /** 17 * Create Users submenu to manage BuddyPress types. 18 * 19 * @since 7.0.0 20 */ 21 function bp_members_type_admin_menu() { 22 if ( ! bp_is_root_blog() ) { 23 return; 24 } 25 26 if ( bp_is_network_activated() && is_network_admin() ) { 27 // Adds a users.php submenu to go to the root blog Member types screen. 28 $member_type_admin_url = add_query_arg( 'taxonomy', bp_get_member_type_tax_name(), get_admin_url( bp_get_root_blog_id(), 'edit-tags.php' ) ); 29 30 add_submenu_page( 31 'users.php', 32 __( 'Member types', 'buddypress' ), 33 __( 'Member types', 'buddypress' ), 34 'bp_moderate', 35 esc_url( $member_type_admin_url ) 36 ); 37 38 } elseif ( ! is_network_admin() ) { 39 add_submenu_page( 40 'users.php', 41 __( 'Member types', 'buddypress' ), 42 __( 'Member types', 'buddypress' ), 43 'bp_moderate', 44 basename( add_query_arg( 'taxonomy', bp_get_member_type_tax_name(), bp_get_admin_url( 'edit-tags.php' ) ) ) 45 ); 46 } 47 } 48 add_action( 'bp_admin_menu', 'bp_members_type_admin_menu' ); 49 50 /** 51 * Checks whether a member type already exists. 52 * 53 * @since 7.0.0 54 * 55 * @param boolean $exists True if the member type already exists. False otherwise. 56 * @param string $type_id The member type identifier. 57 * @return boolean True if the member type already exists. False otherwise. 58 */ 59 function bp_members_type_admin_type_exists( $exists = false, $type_id = '' ) { 60 if ( ! $type_id ) { 61 return $exists; 62 } 63 64 return ! is_null( bp_get_member_type_object( $type_id ) ); 65 } 66 add_filter( bp_get_member_type_tax_name() . '_check_existing_type', 'bp_members_type_admin_type_exists', 1, 2 ); 67 68 /** 69 * Set the feedback messages for the Member Types Admin actions. 70 * 71 * @since 7.0.0 72 * 73 * @param array $messages The feedback messages. 74 * @return array The feedback messages including the ones for the Member Types Admin actions. 75 */ 76 function bp_members_type_admin_updated_messages( $messages = array() ) { 77 $type_taxonomy = bp_get_member_type_tax_name(); 78 79 $messages[ $type_taxonomy ] = array( 80 0 => '', 81 1 => __( 'Please define the Member Type ID field.', 'buddypress' ), 82 2 => __( 'Member type successfully added.', 'buddypress' ), 83 3 => __( 'Sorry, there was an error and the Member type wasn’t added.', 'buddypress' ), 84 // The following one needs to be != 5. 85 4 => __( 'Member type successfully updated.', 'buddypress' ), 86 5 => __( 'Sorry, this Member type already exists.', 'buddypress' ), 87 6 => __( 'Sorry, the Member type was not deleted: it does not exist.', 'buddypress' ), 88 7 => __( 'Sorry, This Member type is registered using code, deactivate the plugin or remove the custom code before trying to delete it again.', 'buddypress' ), 89 8 => __( 'Sorry, there was an error while trying to delete this Member type.', 'buddypress' ), 90 9 => __( 'Member type successfully deleted.', 'buddypress' ), 91 10 => __( 'Member type could not be updated due to missing required information.', 'buddypress' ), 92 ); 93 94 return $messages; 95 } 96 add_filter( 'term_updated_messages', 'bp_members_type_admin_updated_messages' ); -
trunk/src/class-buddypress.php
r12698 r12730 593 593 'BP_REST_Components_Endpoint' => 'core', 594 594 'BP_REST_Attachments' => 'core', 595 'BP_Admin_Types' => 'core', 595 596 596 597 'BP_Core_Friends_Widget' => 'friends',
Note: See TracChangeset
for help on using the changeset viewer.