Support » Plugins » Hacks » [Plugin: Private WP] Edit so that front page is displayed to non-loggedin users?

  • I am using the plugin Private WP, whose sole purpose is to keep non-logged-in users out of your blog. I want to modify it to show the home page, but allow access to no other part of the site if you’re not logged in.

    Here is the entire code of the plugin:

    <?php
    function private_wp() {
      if (!is_user_logged_in()) {
        auth_redirect();
      }
    }
    
    add_action('get_header', 'private_wp');
    ?>

    I tried changing if (!is_user_logged_in()) to if (!is_user_logged_in() && !is_front_page()), but it didn’t work. Does anyone have any idea as to the nature of the problem?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    I have no idea. I added the noted plugin code to my generic testing plugin on my xampp test server, including your change, and it works perfectly. Nothing wrong with your change, the problem lies elsewhere.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Private WP] Edit so that front page is displayed to non-loggedin users?’ is closed to new replies.