• I was gonna call this plugin “Bouncer” but settled for a more explanatory name instead.
    This plugin will allow only registered users of your blog to view the blog. If you have a wordpress powered blog that you don’t want your parents, or the secretary in your office, or the POTUS, to read it(okay, well, I can’t guarantee the last one :P), then View source and save or Download the .zip file to start using it. This will effectively password protect your wordpress blog, and also prevent search engines from indexing the pages in the blog.
    Instructions :

    1. Save the file registered_only.php to your wp-content/plugins folder
    2. Activate the plugin from the plugin administration page
    3. Relax

    Usage Notes:

    1. If you really want your defense against unscrupulous readers to be strong, then disable the “Anyone can register” option in Options->General in your WordPress administration interface.
    2. If you want google and other search engines to be able to index your blog pages, then comment(add two // in the beginning of) the line
      echo '<meta name="robots" content="noindex,follow" />'; . This, however, would mean that the search engines might index your pages and if you want a “private” blog, then this would not be suitable, which is why is it uncommented by default.

    This plugin is basically the auth.php file that ships with WordPress 1.2, adapted to fit needs, and is distributed under the GPL license.
    The Viewlevel plugin might interest some folks. That requires you to add some custom text (something like vl=”x”) to the posts to restrict viewership. Registered only, on the other hand allows only registered users to view the blog, all of it.

Viewing 12 replies - 31 through 42 (of 42 total)
  • Looks like the patched file found here works just fine (so far) with 1.5.1.1:
    https://carthik.net/wpplugins/registered_only_patched.phps

    Thanks!

    Hmm… I’m not doing too well with this plugin. The version posted above gives me a “too many redirects” error when a not-logged-in user tries to view the site, and the version at wp-plugins.org (which is completely different code, though the same author) shows just a blank page, making it rather difficult for users to log in.

    Is anyone else having these problems or am I just “lucky”?

    I got the version from wp-plugins.org to work. The problem was that I had a blank line at the end of the file registered-only.php. I am not a PHP programmer and didn’t realize it was so sensitive to such things.

    I just installed this, version 2005-05-12. I’m using WP 1.5.1. I’ve activated the plugin, but, even after clearing my cache and quitting my browser, and logging out, I can still view the main page. Under meta, it says, “login” not “logout.”

    Any ideas why I can view the blog after enabling the plugin and logging out?

    thanks.

    The most recent version of this plugin does work for me now. Thanks.

    If the plugin at https://carthik.net/wpplugins/registered_only_patched.phps
    makes the “entire weblog password protected” then how does a user with a password get to a login-screen?

    I installed version 0.1 and received this error:

    Warning: Cannot modify header information – headers already sent …

    It was caused by a plug-in, “Event Calendar”, which was writing to the browser before the header() was called. If I deactivate the calendar, the registered_only plug-in works. I tried some of the newer versions and received the redirect too many times error others have reported.

    So I modified the version 0.1 registered_only.php file in this way.
    Comment out these lines:

    //header(‘Expires: Wed, 11 Jan 1984 05:00:00 GMT’);
    //header(‘Last-Modified: ‘ . gmdate(‘D, d M Y H:i:s’) . ‘ GMT’);
    //header(‘Cache-Control: no-cache, must-revalidate’);
    //header(‘Pragma: no-cache’);
    //header($redir);

    and redo this line

    $redir = ‘Location: ‘ . get_settings(‘siteurl’) . ‘/wp-login.php?redirect_to=’ . urlencode($_SERVER[‘REQUEST_URI’]);

    to read

    $redir = get_settings(‘siteurl’) . “/wp-login.php?redirect_to=” . urlencode($_SERVER[‘REQUEST_URI’]);

    then add this line

    echo “<meta http-equiv=’refresh’ content=’0;url=” . $redir . “‘>”;

    in place of this code: header($redir);

    I just installed v.01 on 1.5.1.3 — I got same header errors as frogmoses above, caused by another plugin. (v0.4 didn’t work for me)

    All you have to do, however, is trigger this plugin earlier in the sequence. By default actions are applied with a level of 10. So, just make it less than 10 (or even less, if you still have problems). Add a ‘9’, for example, to the add_action statement at the end of the script, and you’re good to go.

    add_action(wp_head, reject_unverified,9);

    I think this will work. In the plugin, modify the check for the wp-login.php page in the reject_unverified() function to the following:

    if (!ereg(‘wp-login.php’,$_SERVER[‘PHP_SELF’]))

    I’ve got this running on WP2.0 and am pleased with it’s efficiency, with one exception of course.

    When unregistered users reach the login page, they’re given an option to register. I have that enabled in my admin options, yet following the register link only brings them back to the login page.

    Any ideas?

    Hi, under WP2.0, I’ve created a “registered only” blog by adding the following lines to wp-blog-heading.php (between “require_once( dirname(__FILE__) . ‘/wp-config.php’);” and “wp();”…

    // Is there a user logged in?

    get_currentuserinfo();
    if (! $user_ID ) :
    include ‘./wp-login.php’;
    die();
    endif;

    // end

    Wanted to put the check in as early as possible. Stops anyone who isn’t registered viewing the blog and redirects them to the log-in page. Simple and effective.

    Thank you! Thank you! Thank you! dblogger!!!

    I have been looking for a day and a half now about how to do this and you just gave me a quick, simple and easy way!! My server is IIS shared hosting so it makes it even more difficult because I don’t have the shell access I need to set permissions on things.

    Thank you again!! Yay!

Viewing 12 replies - 31 through 42 (of 42 total)
  • The topic ‘Registered Only Plugin : Restrict entire blog to r’ is closed to new replies.