bp_rest_validate_member_types( mixed $value )
Validate member_type input.
Description
Parameters
- $value
-
(Required) Mixed value.
Return
(WP_Error|boolean)
Source
File: bp-core/bp-core-rest-api.php
function bp_rest_validate_member_types( $value ) {
if ( empty( $value ) ) {
return true;
}
$types = explode( ',', $value );
$registered_types = bp_get_member_types();
// Add the special value.
$registered_types[] = 'any';
foreach ( $types as $type ) {
if ( ! in_array( $type, $registered_types, true ) ) {
return new WP_Error(
'bp_rest_invalid_member_type',
sprintf(
/* translators: %1$s and %2$s is replaced with the registered type(s) */
__( 'The member type you provided, %1$s, is not one of %2$s.', 'buddyboss' ),
$type,
implode( ', ', $registered_types )
)
);
}
}
}
Changelog
| Version | Description |
|---|---|
| BuddyBoss 1.3.5 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.