Skip to main content

better_messages_can_send_message

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 filter compatible with Better Messages 2.0.64 or higher

This filter allows to restrict replies to conversation by any custom condition

<?php
add_filter('better_messages_can_send_message', 'custom_reply_restrictions', 20, 3 );

function custom_reply_restrictions( $allowed, $user_id, $thread_id ){
$is_restricted = true;

if( $is_restricted ) {
$allowed = false;

/**
* With this global variable you can add extra message which will replace editor field
*/
global $bp_better_messages_restrict_send_message;
$bp_better_messages_restrict_send_message['your_unique_error_slug'] = 'You cant reply to this thread';

}

return $allowed;
}

When you're restricting the reply with this filter and settings extra message - user will see message like this instead of reply form.

Example