Consider this plugin:
https://wordpress.org/plugins/disable-users/
Works like a charm from within user profile admin.
dashboard > users > username > modify and check Disable User Account
Thanks but this doesn’t work for what we need.
If not so important that the user can’t sign in. What we need is for their BuddyPress profile to disappear when they get suspended and reappear when they get reactivated. We need to be able to put their profiles into sleep mode and not be visible by the public.
Afaik there is nothing out to do this.
As start point, this snippet which let you hide a profile by user_id. Add it to bp-custom.php
function bpfr_hide_user_profile() {
global $bp;
// hide user_id 35
if(bp_is_profile && $bp->displayed_user->id == 35 && $bp->loggedin_user->id != 35) :
wp_redirect( home_url() );
exit;
endif;
}
add_action( 'wp', 'bpfr_hide_user_profile', 1 );
Also, from here
https://buddypress.org/support/topic/temporarily-blocking-a-user-while-keeping-their-datanetwork/
https://wordpress.org/plugins/buddypress-verified/
Thanks, I must have done something wrong.
I pasted in this code at the end of bp-custom.php and it crashed the site…
Do you use open and closing php tags ?
A bp-custom.php file must contain one opening and one closing tag. And like any php file, without any blank line at begin and end of file. Here the one i’m using since years.
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
//////////////////////////////// - custom stuff start here - /////////////////////////////////
function one() {
....
}
function whatever() {
...
}
//////// end of custom stuff /////////////////
?>
Thanks, I have this working now but the users are still visible. It does redirect to homepage if you try and click on them, but we need them to vanished once their account is suspended. and reappear again when they are reactivated.