Support » Plugin: UsersWP - User Registration & User Profile » Require login to view users page

  • Resolved sparkyparks

    (@sparkyparks)


    I want to make the Users page (I’ve retitled it Directory) to be hidden until after a user is logged in. That is, I want the short code [uwp_users] to somehow only display after users login.

    To protect our users I have disabled the plugin to hide the Users page until this is addressed.

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • You can try this code snippet.

    // remove a template redirect from within a custom plugin.
    add_action( 'template_redirect', 'remove_my_action', 5 );
    function remove_my_action(){
    	if( is_uwp_page( 'users_page' ) ){ // if users list page. 
    		$login_url = uwp_get_page_link('login');
    		wp_redirect( $login_url, 301 ); exit;
    	}
    }

    Regards

    Thread Starter sparkyparks

    (@sparkyparks)

    Thank you.
    Now, where do I insert that snippet?
    I’m using Divi theme and I tried putting it in a Code module on the User page but it failed.
    Sorry for my lack of experience on the code side of things.

    Thread Starter sparkyparks

    (@sparkyparks)

    Excellent! We are 99% of the way there.
    The snippet redirects to the login page. But then once logged in it loops back to the User Account page. Even once the Account is complete and updated I can’t get to the Users Page (what I’ve retitled Directory).

    On a related note, I noticed that on the Login Page there is a Create Account link. I would like to remove that link. All users will be Admin created and imported.

    Thanks!

    Hello,

    #1. UsersWP provides you an option to set a redirection page after user login.
    Please check it https://ibb.co/2S3Ddnt

    #2. That is the user registration form link. if you want to remove/hide it.
    Please try the following style.

    
    .uwp-footer-link .uwp-register-link{ 
        display: none !important 
    } 
    
    Thread Starter sparkyparks

    (@sparkyparks)

    I’m so sorry. I’ve attempted the page redirection as shown in the example. The loop continues. Something in the snippet has the [uwp_users] redirecting to the Account page rather than the page that contains the [uwp_users] shortcode on it.

    Thank you for your efforts and responsiveness!

    That setting intended for that work.
    if any way it is not working on your end. It could be a conflict issue.

    Please create a support ticket, we will look further
    https://userswp.io/support/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Require login to view users page’ is closed to new replies.