Tagged: profile security, profile visibility
Hi there! Hoping you might point me in the right direction. I’m trying to restrict a specific role from being able to view any profile other than their own. I feel like I’ve tried everything and every plugin out there but no solutions just yet. I’d ideally like to do this without modifying the theme’s profile page and rather as a function in the functions.php page.
Any help would be wonderful!
Thanks again!
This is what I’ve tried so far:
add_action( ‘Prevent_Tenant_From_Others_profile’, function() {
if ( bp_is_user_profile() ) {
$user_meta = get_userdata( bp_loggedin_user_id() );if ( in_array( ‘tenant’, $user_meta->roles ) ) {
wp_redirect( home_url() );
exit;
}
}
}, 1 );Hello,
Thank you for posting. Please refer the url:
https://gist.github.com/raviousprime/1a1cbf1ce75b63cae787495c7dc578dbIt allows to restrict user to view others profile based on his role.
Regards
Ravi
The topic ‘ [Resolved] Restrict BP users from viewing other's profile based on role’ is closed to new replies.