• Some of my users asked me if I could add an option so they can decide that only logged in users can see their profile for privacy reasons.

    Would that be possible somehow?

    At the moment you can only set it private for everyone or for noone.

Viewing 1 replies (of 1 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Hello @michaelpersch

    Unfortunately, this requires some customization. You can add a checkbox field on the user profile with metakey ‘_restricted_to_logged_in_users’ and place the following code snippets:

    add_action('template_redirect',function(){
    	if( function_exists('UM')){
    		if( um_is_core_page( 'user' ) ){
    
    			$profile_id = um_profile_id();
    			
    			$is_restricted_to_logged_in_users = get_user_meta( $profile_id,'_restricted_to_logged_in_users',true );
    
    			if( $is_restricted_to_logged_in_users ){
    
    				exit( wp_redirect( get_home_url() ) );
    			}
    		}
    	}
    });

    The above code redirects the user to the home page if a user has set a profile to be visited only by logged-in users. Please feel free to customize the codes as per your requirement.

Viewing 1 replies (of 1 total)
  • The topic ‘Show profile only for logged in users’ is closed to new replies.