Viewing 1 replies (of 1 total)
  • Thread Starter valcorin

    (@valcorin)

    For those who just want all users who aren’t logged in directed to the login page, you can modify the plug-in to the following:

    <?php
    /*
    Plugin Name: Protected Site
    Description: Block users from accessing your blog or a specific blog in your network by activating this plugin on the blog you wish to protect.
    Author: Davo Hynds
    Version: 1.0
    Author URI: https://ashramcreative.com
    Modification: Code modified to redirect to the login page rather than requiring a click through
    */
    
    add_action( 'get_header', 'ac_protected_site' );
    function ac_protected_site() {
    	if ( !is_user_logged_in() ) {
    		$bigurl = home_url().'/wp-login.php?redirect_to=';
    		$path = parse_url(get_bloginfo('url'),PHP_URL_SCHEME).'://'.parse_url(get_bloginfo('url'),PHP_URL_HOST).$_SERVER['PHP_SELF'];
    		$bigurl = $bigurl.$path;
    		header( "Location: $bigurl" );
    	}
    }
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Protected Site] Double folder name’ is closed to new replies.