BP_REST_Group_Messages_Endpoint::bp_rest_groups_messages_new_message( array|string $args = '' )
Create New Group Message.
Description
— from bp_groups_messages_new_message();
Parameters
- $args
-
(Optional) Array of arguments
Default value: ''
Return
(int|bool|WP_Error) ID of the message thread on success, false on failure.
Source
File: bp-messages/classes/class-bp-rest-group-messages-endpoint.php
public function bp_rest_groups_messages_new_message( $args = '' ) { $send = ''; remove_action( 'messages_message_sent', 'messages_notification_new_message', 10 ); add_action( 'messages_message_sent', 'group_messages_notification_new_message', 10 ); $r = bp_parse_args( $args, array( 'sender_id' => bp_loggedin_user_id(), 'thread_id' => false, // False for a new message, thread id for a reply to a thread. 'recipients' => array(), // Can be an array of usernames, user_ids or mixed. 'subject' => false, 'content' => false, 'date_sent' => bp_core_current_time(), 'append_thread' => false, 'is_hidden' => false, 'mark_visible' => false, 'group_thread' => true, 'error_type' => 'wp_error', ), 'bp_groups_messages_new_message' ); // Attempt to send the message. $send = messages_new_message( $r ); remove_action( 'messages_message_sent', 'group_messages_notification_new_message', 10 ); add_action( 'messages_message_sent', 'messages_notification_new_message', 10 ); return $send; }
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.