bp_groups_messages_validate_message( mixed $send, string $type = 'all' )

Check group message has been successfully sent or not.

Description

Parameters

$send

(Required) int|bool|WP_Error

$type

(Optional) Type of the message all or individual.

Default value: 'all'

Source

File: bp-templates/bp-nouveau/includes/groups/ajax.php

1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
function bp_groups_messages_validate_message( $send, $type = 'all' ) {
    if ( is_wp_error( $send ) ) {
        $response['feedback'] = $send->get_error_message();
        wp_send_json_error( $response );
    } elseif ( ! empty( $send ) ) {
        if ( 'individual' === $type ) {
            $response['feedback'] = __( 'Your message was sent to %%count%% members of this group.', 'buddyboss' );
        } else {
            $response['feedback'] = __( 'Your message was sent to all members of this group.', 'buddyboss' );
        }
        $response['redirect_link'] = '<a href="' . bp_loggedin_user_domain() . bp_get_messages_slug() . '"> ' . __( 'View message.', 'buddyboss' ) . '</a>';
        $response['type']          = 'success';
        wp_send_json_success( $response );
    }
}

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.