Skip to main content

better_messages_message_sent

REQUIREMENTS

To be able to implement this guide, you need to learn how to insert PHP snippets to your website.

You can find guide here: WP Beginner

Compatibility
This action compatible with Better Messages 2.0.75 or higher

This action is triggered when new message is sent

add_action( 'better_messages_message_sent', 'on_message_sent', 10, 1 );

function on_message_sent( $message ){
// Sender ID
$user_id = (int) $message->sender_id;

// Recipients User IDs
$recipients = (array) $message->recipients;

// Conversation ID
$thread_id = $message->thread_id;

// Message ID
$message_id = $message->id;

// Message Content
$content = $message->message;
}