Support » Plugin: Members » Internal Server and 302 error on Redirect all logged-out users

  • We encountered a page that indicates “Internal Server and 302 error” when “Redirect all logged-out users to the login page before allowing them to view the site.” is checked.

    We embedded the members login widget on the home page and are also using the “redirection” plugin to ensure all access goes to the home page.

    Everything is fine when activating the “Enable the content permissions feature.” However, we rather have users redirected to the home page instead.

    Any idea how to fix this?

Viewing 1 replies (of 1 total)
  • Plugin Author Justin Tadlock

    (@greenshady)

    It sounds like it is behaving correctly, so that’s good. The option “Redirect all logged-out users to the login page…” is literally attempting to do what it’s supposed to do — redirect users to the login page. If you throw another redirect at that, you’ll get the problem you’ve run into with an infinite loop of redirects, causing a server error.

    You can whitelist any page on your site via the members_is_private_page filter hook. Here’s a code example to do that for the front page:

    
    add_filter( 'members_is_private_page', function( $is_private ) {
    
    	return is_front_page() ? false : $is_private;
    
    } );
    

    You can’t change where the Members’ Private Site feature redirects at this time though. The above merely marks the front page as a non-private page.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.