Changeset 12765 for trunk/src/bp-members/bp-members-functions.php
- Timestamp:
- 10/24/2020 12:20:39 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-functions.php
r12754 r12765 2994 2994 * 2995 2995 * @since 2.2.0 2996 * 2997 * @param int $user_id ID of the user. 2998 * @param string $member_type Member type. 2999 * @param bool $append Optional. True to append this to existing types for user, 3000 * false to replace. Default: false. 2996 * @since 7.0.0 $member_type parameter also accepts an array of member type names. 2997 * 2998 * @param int $user_id ID of the user. 2999 * @param string|array $member_type The member type name or an array of member type names. 3000 * @param bool $append Optional. True to append this to existing types for user, 3001 * false to replace. Default: false. 3001 3002 * @return false|array $retval See {@see bp_set_object_terms()}. 3002 3003 */ 3003 3004 function bp_set_member_type( $user_id, $member_type, $append = false ) { 3004 3005 // Pass an empty $member_type to remove a user's type. 3005 if ( ! empty( $member_type ) && ! bp_get_member_type_object( $member_type ) ) { 3006 return false; 3006 if ( ! empty( $member_type ) ) { 3007 $member_types = (array) $member_type; 3008 $valid_types = array_filter( array_map( 'bp_get_member_type_object', $member_types ) ); 3009 3010 if ( $valid_types ) { 3011 $member_type = wp_list_pluck( $valid_types, 'name' ); 3012 } else { 3013 return false; 3014 } 3007 3015 } 3008 3016 … … 3018 3026 * @since 2.2.0 3019 3027 * 3020 * @param int $user_id ID of the user whose member type has been updated.3021 * @param string $member_type Member type.3022 * @param bool $append Whether the type is being appended to existing types.3028 * @param int $user_id ID of the user whose member type has been updated. 3029 * @param string|array $member_type The member type name or an array of member type names. 3030 * @param bool $append Whether the type is being appended to existing types. 3023 3031 */ 3024 3032 do_action( 'bp_set_member_type', $user_id, $member_type, $append ); … … 3123 3131 * @since 2.2.0 3124 3132 * 3125 * @param string $type Member type. 3126 * @param int $user_id ID of the user. 3127 * @param bool $single Whether to return a single type string, or an array. 3133 * @param string|array|bool $type a single member type (if $single is true) or an array of member types 3134 * (if $single is false) or false on failure. 3135 * @param int $user_id ID of the user. 3136 * @param bool $single Whether to return a single type string, or an array. 3128 3137 */ 3129 3138 return apply_filters( 'bp_get_member_type', $type, $user_id, $single );
Note: See TracChangeset
for help on using the changeset viewer.