WordPress.org

Ready to get started?Download WordPress

Forums

WP-Members
[resolved] Block whole site or summary of postings? (3 posts)

  1. schoy
    Member
    Posted 2 years ago #

    I notice that when users are not logged in, they can still see summary in recent posts.

    If not logged in, is there a way to block the whole site and redirect to the login/registration page?

    If not, is it possible to not show the summary of postings?

    Thanks.

  2. Chad Butler
    Member
    Plugin Author

    Posted 2 years ago #

    There isn't anything built into the plugin. But you could work something into your theme.

    Supposing you created a login page with the [wp-members page="login"] shortcode and wanted unregistered users directed to there, then you could wrap The Loop with something like this...

    <?php if( is_user_logged_in() ) { ?>
    
    ... The Loop goes here ...
    
    <?php } else {
    
    wp_redirect( 'http://mydomain.com/myloginpage' ); exit;
    
    } ?>
  3. schoy
    Member
    Posted 2 years ago #

    Thanks for the tip. I ended up redirecting in the header.php, something like this:

    if (!(is_user_logged_in())) {
    if (($_SERVER["REQUEST_URI"] != '/login-page'){
    wp_redirect( 'http://my.domain.com/login-page' );
    exit;
    }
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags