Make the profile not clickable for unregistered and non logged in users.
-
Hi there,
How to make the the user profile not clickable for non logged users and logged users as well. I have the code which enables the user himself and admin to open the profile but when any other user clicks on the profile, the page redirects to the home page. What i actually want is that to disable the click function for unregistered users and registered users as well. Only admin and user can access the profile link. I don’t know if i am clear enough Lol. Here’s the code i am using.
function private_profiles() { // Bail if not a profile page. if ( ! bp_is_user_profile() ) return; // Allow admin users. if ( current_user_can( 'manage_options' ) ) return; // Allow the profile owner. if ( bp_loggedin_user_id() == bp_displayed_user_id() ) return; // If we get to here, redirect to homepage. bp_core_redirect( home_url() ); } add_action( 'init', 'private_profiles' );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.