bp_rest_validate_group_types( mixed $value )

Validate group_type input.

Description

Parameters

$value

(Required) Mixed value.

Return

(WP_Error|bool)

Source

File: bp-core/bp-core-rest-api.php

276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
function bp_rest_validate_group_types( $value ) {
    if ( empty( $value ) ) {
        return true;
    }
 
    $types            = explode( ',', $value );
    $registered_types = bp_groups_get_group_types();
    foreach ( $types as $type ) {
        if ( ! in_array( $type, $registered_types, true ) ) {
            return new WP_Error(
                'bp_rest_invalid_group_type',
                sprintf(
                /* translators: %1$s and %2$s is replaced with the registered types */
                    __( 'The group type you provided, %1$s, is not one of %2$s.', 'buddyboss' ),
                    $type,
                    implode( ', ', $registered_types )
                )
            );
        }
    }
}

Changelog

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.