/** * Redirects users that are not logged in to the 'wp-login.php' page. * * @since 0.1.0 * @access public * @return void */ function members_please_log_in() { // Check if the private blog feature is active and if the user is not logged in. if (members_is_private_blog() && !is_user_logged_in()) { // If using BuddyPress and on the register page, don't do anything. if (function_exists('bp_is_current_component') && bp_is_current_component('register')) { return; } // Redirect to the login page. auth_redirect(); exit; } }
/** * Enable private site field callback. * * @since 1.0.0 * @access public * @return void */ public function field_enable_private_site() { ?> <label> <input type="checkbox" name="members_settings[private_blog]" value="true" <?php checked(members_is_private_blog()); ?> /> <?php esc_html_e('Redirect all logged-out users to the login page before allowing them to view the site.', 'members'); ?> </label> <?php }