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

Check group message has been successfully sent or not.

Description

Parameters

$send

(mixed) (Required) int|bool|WP_Error

$type

(string) (Optional) Type of the message all or individual.

Default value: 'all'

Source

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

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.