BuddyDev

Search

BuddyPress Moderation Tools support

  • Participant
    Level: Guru
    Posts: 900
    Tosin on #26612

    ok thanks very much

  • Participant
    Level: Guru
    Posts: 900
    Tosin on #26641

    Have you been able to test this

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #26692

    Hi Tosin,
    I am sorry for the delayed reply.

    There was abug in the code. In the abov code I was using in_array for checking and doing a strict check(checkes for type and value both).

    The value passed did not match the type an dthat’s why it was not working.

    Here is the update code.

    
    // BuddyPress Moderation Tools: White list specific user's content from moderation.
    add_filter( 'bpmts_is_user_whitelisted', function ( $is, $user_id ) {
    	$white_listed_users = array( 284, 37845, 4578, 2357 );
    	if ( in_array( $user_id, $white_listed_users ) ) {
    		$is = true;
    	}
    
    	return $is;
    }, 10, 2 );
    
    // BuddyPress Moderation Tools: Do not allow white listed user's profile to be reported.
    add_filter( 'bpmts_is_item_reportable', function ( $is, $item_type, $item_id ) {
    	if ( 'user' !== $item_type ) {
    		return $is;
    	}
    
    	$white_listed_users = array( 284, 37845, 4578, 2357 );
    	if ( in_array( $item_id, $white_listed_users ) ) {
    		$is = false;
    	}
    
    	return $is;
    }, 10, 3 );
    
    

    It will work now.

    Regards
    Brajesh

  • Participant
    Level: Guru
    Posts: 900
    Tosin on #26698

    You are a genius the code worked perfectly. But I would like to know if it was possible to hide the button on the user profile entirely for those specific IDs.

    The reason is there are specific accounts used in moderating the site so it would not make sense to display the report button on those profile, I don’t want users to report moderator profiles and branded profiles.

    Maybe a filter to hide the report button on those specific IDs

    Thanks so much

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #26699

    Hi Tosin,
    Thank you. I have been planning to solve this in efficient way and I am implemnting it in next update.

    We will have a filter for the same.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved