BuddyDev

Search

Replies

  • Participant
    Level: Guru
    Posts: 903

    Hello,

    The code worked perfectly thank you so much im very grateful.

    Now that the buttons are hidden it is still possible to send public messages directly on the Activities page, will it be possible to disable (@usernames) for those specific restricted ids on Activity status form for posting updates.

    Thanks

  • Participant
    Level: Guru
    Posts: 903

    Sir I understand the problem better like you said your code limits restricted users from sending messages but what I’m trying to achieve is opposite, I want to limit the restricted users from RECEIVING messages (The buttons should be hidden for the restricted users)

    Thank you very much

  • Participant
    Level: Guru
    Posts: 903

    Sir I’m still expecting your feedback

    Thank you

  • Participant
    Level: Guru
    Posts: 903

    Hello Brajesh,

    Thank you so much for you help I will do as instructed, I have deactivated the BP Profile Message UX plugin but I noticed that the same issue occurs even with the default buddypress message using the first code you sent

      /**
     * HIDE BUDDYPRESS PUBLIC AND PRIVATE MESSAGE BUTTON FOR SPECIFIC USERS.
     */ 
     
     function buddydev_hide_public_button( $r ) {
    
    	if ( ! is_user_logged_in() ) {
    		return $r;
    	}
    
    	$restricted_user_ids = array( 2, 4766812, 4766806, 4766824, 4766786, 4766838 ); // Replace by yours user ids.
    
    	if ( in_array( get_current_user_id(), $restricted_user_ids ) ) {
    		return false;
    	}
    
    	return $r;
    }
    add_filter( 'bp_get_send_public_message_button', 'buddydev_hide_public_button' );
    add_filter( 'bp_get_send_message_button_args', 'buddydev_hide_public_button' ); 

    1. The code only works for the admin and not all users

    2. The code works but it hides the buttons for (all users) instead of just the specific ids

  • Participant
    Level: Guru
    Posts: 903

    Hello,

    1. The code only works for the admin and not all users

    2. The code works but it hides the buttons for (all users) instead of just the specific ids

  • Participant
    Level: Guru
    Posts: 903

    Hello,

    The code works when I deactivate this plugin (bp-profile-message-ux). This plugin is conflicting with your code https://wordpress.org/plugins/bp-profile-message-ux/ Is there any way you can make the code to be compatible with this plugin.

    Also, when I deactivate the BP PROFILE MESSAGE UX plugin your code still hides the public and private message buttons for all my users instead of only the specific ids I stated.
    This is the code im using

     /**
     * HIDE BUDDYPRESS PUBLIC AND PRIVATE MESSAGE BUTTON FOR SPECIFIC USERS.
     */ 
     
     function buddydev_hide_public_button( $r ) {
    
    	if ( ! is_user_logged_in() ) {
    		return $r;
    	}
    
    	$restricted_user_ids = array( 2, 4766812, 4766806, 4766824, 4766786 ); // Replace by yours user ids.
    
    	if ( in_array( get_current_user_id(), $restricted_user_ids ) ) {
    		return false;
    	}
    
    	return $r;
    }
    add_filter( 'bp_get_send_public_message_button', 'buddydev_hide_public_button' );
    add_filter( 'bp_get_send_message_button_args', 'buddydev_hide_public_button' ); 

    Thanks

  • Participant
    Level: Guru
    Posts: 903

    Hello Brajesh,

    The code did not work the public and private message buttons are still visible for the specific user ids I selected.

  • Participant
    Level: Guru
    Posts: 903

    Hello Brajesh,

    Thanks but I wasn’t referring to roles and capabilities but specific user ids

    Thank you

  • Participant
    Level: Guru
    Posts: 903

    Awaiting your feedback sir

  • Participant
    Level: Guru
    Posts: 903

    The notice approach would be good.

    Thank you very much