Skip to:

Restricting private messages

  • devbad


    I am looking for some help with restricting private messages.

    I have Paid Memberships Pro – BuddyPress Add On Version 1.2.1 and BP Better Messages (Premium) Version with WordPress 5.1
    BuddyPress Version 4.2.0

    I am looking for a way to restrict the private message option for certain type of users. I am trying to have this modification multiple ways, with and without PMPro but none of them working so far.

    With PMPro I supposed to restrict easily, still I can only totally restrict all BuddyPress functions or enable all of them, customization looks like broken.

    I looked into the codes of all the mentioned plugins, tried to restrict access by using below code that I found in another topic:

    add_filter( 'bp_get_send_message_button', function( $array ) {
        if ( pmpro_hasMembershipLevel('Premium') ) {
            return $array;
        } else {
            return '';
    } );

    Maybe I am just trying to make it too complicated and there is an easier way to do it with shortcodes under the Members page that currently contains only [bps_directory] shortcode.

    Any suggestion and help would be welcome.

Viewing 4 replies - 1 through 4 (of 4 total)

  • Venutius


    Hi there, are you using the Nouveau template at all? If so I reckon a better way to do this would be to remove the private message button from the buttons array using the bp_nouveau_get_members_buttons filter.

    So something like:

    add_filter( 'bp_nouveau_get_members_buttons', 'venutius_check_private_message_button' );
    function venutius_check_private_message_button( $buttons ) {
        if ( ! pmpro_hasMembershipLevel('Premium') ) {
            unset( $buttons['private_message'] );
        return $buttons;



    Sorry, I forgot to mention that yes, I am using the Nouveau template.
    Considering the plugins that I am using with the Nouveau template, where exactly should I insert this code? I mean to which file to get the result and not being overridden by another plugin or template?



    You can put it in the functions.php file of a child theme.



    i am trying to hide the received message content even with a banner to increase the need to pay the required levels. could anybody support me?

    Similar success example that increased the revenue with 300%
    i am using BP better message also

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar