Registered Only Plugin Reworked

I finally got to rewriting the Registered Only plugin. The new version works on WordPress version 1.5.1 and 1.5. The older version had some issues. The new version is much lighter, and uses a core WordPress function, and so should work without any issues. If there are any issues, please report them at the wp-plugins.org issue tracker.

The registered only plugin restricts access to the WordPress weblog and site (including Pages, if any), to registered users who are logged in. This will be useful for those that want a private blog, or a blog restricted to friends and family. Consider it the WordPress version of a friends-only Livejournal or similar.

The latest version has the tag (version number) 2005-05-12-2000. I will be using a YYYY-MM-DD-HHMM (in UTC time) (based on the ISO8601) format for version numbers, since it seems easily sortable, and conveys information about the freshness of the version. You can download it from the wp plugin repository, save the file as registered-only.php and then upload it to your wp-content directory on the web server.

There is now a readme file with relevant details.

Many thanks to the many users who wrote in regarding this plugin over the days. Leave me a comment if you use the plugin and like, or better still, dislike it.

Update: This plugin does not protect your feeds. So you may want to delete the feed files.

Other Articles on this Subject:

72 Responses to “Registered Only Plugin Reworked”

  1. May 12th, 2005 | 3:37 pm

    […] in Updated
    Filed under: Plugins — Carthik @ 4:37 pm

    I have updated the Registered-Only Plugin which provides an effective way to protect your […]

  2. May 12th, 2005 | 4:59 pm

    Registered Only plugin updated

    Carthik finally got time to update the Registered Only plugin. He was nice enough to email those who asked him! It restricts everything on your blog to registered members only, but I don’t think it protects your RSS feeds. Nevertheless, this loo…

  3. gweth
    May 12th, 2005 | 5:12 pm

    Thanks for the update! Great plugin for people like me that want privacy.

  4. May 12th, 2005 | 6:46 pm

    good question in the comment: does it protect the rss feeds too? :)

  5. May 12th, 2005 | 6:55 pm

    Denis,

    I have since updated the post, as well as the readme, to state that it does not protect the feeds. I suspect very few, if any feed readers support any form of authentication :)

  6. Madolyn
    May 14th, 2005 | 8:46 pm

    Having just switched from 1.2 to 1.5 I notice there is an option to restrict commenting to registered, logged-in users. I like your plugin but don’t now see the need to install it - I only wanted to restrict who could comment, not who could read (since the password function covers that for my needs).

  7. May 14th, 2005 | 8:52 pm

    Madolyn,

    The plugin would be handy if you wanted to password protect the entire blog in one swell sweep, as opposed to protect each individual entry, one by one.

  8. fil
    May 14th, 2005 | 9:30 pm

    FYI, the post levels plugin provides more granular control over hidden posts and does protect RSS feeds.

  9. Todd
    May 15th, 2005 | 9:30 pm

    I am using WP 1.2.2. The plug in works fine. However, is there a way after a user log in to direct them immediately to the index.php rather than the wp-admin/post.php?

  10. May 16th, 2005 | 12:41 am

    Todd,

    The plugin is supposed to just redirect the visitor to the page that they arrived at. So, if someone tried to access index.php and got to the login page, they should be redirected to that index.php page after logging in. That is the way it works with 1.5 currently.

  11. May 16th, 2005 | 9:19 am

    Technically, a hashed key is very much equivalent to login/password. So you could create a somewhat minor authentication method by adding a hashed key in the feed url, e.g.:

    blog.carthik.net/feed/?key=fecqzhechziff434Q4YGFDGW898655

  12. May 16th, 2005 | 9:25 am

    Sweet!! I’m going to try it out as soon as I get the time

  13. May 16th, 2005 | 10:02 am

    Any thoughts why this wouldn’t work on an (essentially) fresh WordPress 1.5 install?

  14. May 16th, 2005 | 1:10 pm

    Bryan,

    I will try and install 1.5 on my test setup and look into this. The major difference is that 1.5 did not have the pluggable-functions.php file in wp-includes that 1.5.1 has. So I may need to factor that in, for 1.5.

  15. May 16th, 2005 | 1:17 pm

    Awesome, thank you Carthik!

  16. fil
    May 17th, 2005 | 2:43 pm

    Carthik, I’ve have instructions on my site for updating plugins to 1.5.1: http://fortes.com/2005/05/14/updating-wordpress-plugins-for-151

  17. May 17th, 2005 | 2:50 pm

    fil,

    Thanks, but that was already taken care of in the this version of the registered-only plugin.

  18. June 17th, 2005 | 12:18 pm

    […] peut également verrouiller son blog WordPress totalement, comme sur TypePad par exemple. Un plugin a été développé dans ce sens par Carthik […]

  19. June 21st, 2005 | 11:30 am

    Great plugin! Installed it one of my sites, and it works seamlessly. However, I’ve noticed that when I enter my URL, login as admin, I get the index page, but this does not happen to a level 0 user; the level 0 user enters his/her profile page instead. Is this how its supposed to behave? Or do I need to change the user level? Thanks!

  20. craig
    June 22nd, 2005 | 1:47 pm

    The plugin works almost too good. If the plugin is activated, my rss feeds are blocked when using any sort of rss client. As well, I can’t post through the xmlprc.php. Anyone else seeing this sort of thing?

  21. todd
    June 25th, 2005 | 12:47 pm

    This will also block access to wp-register.php. Changed my if statement to read as follows:

    if (substr($_SERVER[’SCRIPT_NAME’], -12) != “wp-login.php” && substr($_SERVER[’SCRIPT_NAME’], -15) != “wp-register.php”) {

    I suspect excluding rss feeds would just require adding the appropriate condition there as well.

  22. Will
    June 29th, 2005 | 5:29 am

    Does not work here. :(

    Redirection limit for this URL exceeded. Unable to load the requested page. This may be caused by cookies that are blocked.

    The browser has stopped a connection because the site is redirecting requests to itself in a manner which prevents it from ever completing.

    So it seems its an endless loop. :(

  23. craig
    June 29th, 2005 | 6:58 pm

    […]if (substr($_SERVER[’SCRIPT_NAME’], -12) != “wp-login.php” && substr($_SERVER[’SCRIPT_NAME’], -15) != “wp-register.php”) { […]

    Thanks, that works so far.

  24. #3
    June 29th, 2005 | 10:14 pm
  25. Jason
    June 30th, 2005 | 9:09 am

    I installed this plugin on my blog and it does exactly when it is supposed to do but I was wondering if there is a fix for something I would like to do.

    I want to password protect the blog from only registered users but I want to be allowed to send users to register on their own. Currently the only way I see is to get registered members first then lock the blog down or to manually add members which I want to avoid.

    Any ideas?

    Thanks,

    Jason

  26. wally
    July 8th, 2005 | 2:23 am

    does not work here. 5/12/2005 version installed on 1.5.1.3. I can log in as admin, and have it set where anyone can register. However, when someone tries to register which directs them to register.php, or whatever, it gets redirected back to the login page. Endless cycle.

    Any ideas? This is exactly what I’m looking for if I can get it to work.

  27. July 8th, 2005 | 11:59 am

    […] do it so you don’t have to enter the password each time, I will. I’ve tried this plugin, and for some reason it doesn’t work correctly on my […]

  28. Maria
    August 7th, 2005 | 5:22 am

    Thank you so much for the updated version, it finally works perfect for me! I have a question, which might be stupid but still.. is this plugin really safe? Is it guaranteed that the pages and posts will not be accessible from search engines etc?

  29. August 8th, 2005 | 9:57 pm

    Maria,

    If you take care to remove the files that I have requested users to remove etc, it will be perfectly safe. Please read the readme file in the download, or the instructions in the post, and you’ll be good.

  30. Sam
    August 17th, 2005 | 5:53 am

    I have two blogs with this plugin installed, and I’d like to pingback between them, but the pingback feature doesn’t seem to work once the plugin is activated. This was confirmed when I tested the pingback using Red Alt’s pingback test page.

    Is there a way to allow pingbacks with this plugin activated? I don’t mind only allowing pingbacks from just my other blog.

    Otherwise, I’ve found your work very helpful!

  31. August 17th, 2005 | 5:35 pm

    Hmm, pingbacks won’t work, as you just found out. I see the case for why they should in your case. I am sort of short of time right now, but what I can suggest is that you try to avoid the redirection from happening for the url of the xmlrpc.php file in your weblog. Mine is http://blog.carthik.net/xmlrpc.php I should expect this to work.

    In the plugin, Edit:
    if (substr($_SERVER[’SCRIPT_NAME’], -12) != “wp-login.php”) {

    to read

    if ((substr($_SERVER[’SCRIPT_NAME’], -12) != “wp-login.php”)||(substr($_SERVER[’SCRIPT_NAME’], -10) != “xmlrpc.php”)) {

    … you hopefully get the idea :)

  32. Sam
    August 18th, 2005 | 5:26 am

    It still doesn’t seem to work.

    Using the Red Alt pingback tool, I got a very unhelpful response (the same I got before the modification):

    Could not discover pingback URL.

    I tried sending a trackback as well from Red Alt, and got the following response (also the same as before the modification):

    HTTP/1.1 302 Found
    Date: Thu, 18 Aug 2005 09:54:28 GMT
    Server: Apache
    X-Powered-By: PHP/4.4.0
    Expires: Mon, 11 Jan 1984 05:00:00 GMT
    Last-Modified: Thu, 18 Aug 2005 09:54:28 GMT
    Cache-Control: no-cache, must-revalidate, max-age=0
    Pragma: no-cache
    Location: http://www.mysite.org/secureblog/wp-login.php?redirect_to=%2Fsecureblog%2Findex.php%2Farchives%2F2005%2F08%2F18%2Fdc-trip%2F
    Connection: close
    Content-Type: text/html

    With my limited knowledge, it looks to me like it’s still trying to redirect…

    Thanks for your time.

  33. August 18th, 2005 | 11:16 am

    Just as I thought, it won’t work since when you try to pingback a post, there is a process of autodiscovering the pingback url (of xmlrpc.php), and it won’t work since that will be bounced. I am sorry. The modification required might be more complicated, to ensure that pingback and trackback requests can bypass the plugin…

  34. Stephanie
    August 18th, 2005 | 4:57 pm

    Having the same problem as rain: the user is redirected to their profile page instead of the home page.

    Does auth_redirect() accept arguments? I couldn’t find much on it in the docs, but if it does, that’d be a solution…

  35. Stephanie
    August 18th, 2005 | 6:41 pm

    Feeling dumb… the solution is to promote the user to at least level 1.

  36. August 19th, 2005 | 12:20 am

    I keep trying to download you file and all I get are empty zip files !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  37. Sam
    August 19th, 2005 | 3:32 am

    Ok. As this feature is rather important for me for these two blogs, I guess I’ll use .htaccess to restrict access.

    Your plugin is still useful for some of my other sites, though!

  38. August 19th, 2005 | 9:06 pm

    Andromeda,

    You can visit the wp-plugins page for the plugin and click on one of the two download links at the bottom of the page. Please ensure that the plugin file does not have any blank lines at the top or the bottom before you use it.

  39. Ron
    August 25th, 2005 | 11:27 am

    warning [D:\Downloads\WordPress\registered-only_2005-05-12-2000.zip]: Zip file is empty
    No files to process

  40. August 25th, 2005 | 12:01 pm

    Ron, see the comment above yours, please :)

  41. Ron
    August 25th, 2005 | 4:27 pm

    Actually, I read the posts. Is there some reason you haven’t fixed the broken zip or removed the link alltogether? Very confusing.

  42. August 25th, 2005 | 4:40 pm

    That is a system that provides for automatic downloads from the WP plugins repository. I guess I will change the link for now - I had left it in thinking it was a temporary problem.

  43. August 30th, 2005 | 2:27 am

    I’ve installed and tested this, and everything works fine. Thanks for creting this! I do, however, have a question - can I specify a single username and password, and have all my readers log on with this one ID? Or do I still need to create multiple IDs? Thanks again.

  44. W2D
    September 4th, 2005 | 5:49 am

    Bloody fantastic! You are awesome, Carthik. Great work!

  45. September 12th, 2005 | 3:44 pm

    I’m working with this plugin, and I’m dealing with two issues.

    (1) Is changing the look of the wp-login page. Does anyone know of a way to change the look of this page without actually editing it? What I’m looking for is a way to change the display of this page with something like the Themes system, which doesn’t include hacking “core” files.

    (2) In the same line with not editing “core” files, I’m looking for a way to disable all feeds via a plugin or setting - anything that wouldn’t require deleting the “core” files. I’m working on a little plugin to do this, but I also wondered…

    Can you just set the number of posts to show in your Feeds to ZERO, thereby “disabling” your feeds with one options change? Please check out the settings here: wp-admin/options-reading.php and let me know if you can test this.

  46. September 26th, 2005 | 11:01 am

    I just finished a plugin that (I hope) can serve as a compliment to Registered Only. It’s called Secure Files, and it’s aim is to protect your loose files (images, documents, etc) when using a plugin like Registered Only. You can check it out here:

    http://www.almosteffortless.com/?page_id=16

    …This plugin is great for people using plugins like Registered Only (and here) that secure your Wordpress blog (Posts, Pages, etc). The problem with these plugins is that your loose files aren’t protected - only the contents of your Wordpress database. So, any images or other documents you’ve uploaded are easily accessible to those who aren’t authenticated via a plugin like Registered Only. This plugin aims to solve this problem…

  47. Jim Tobias
    October 4th, 2005 | 4:12 pm

    When I attempt to activate this I get a string of warnings about “Headers already loaded” or some such. Is this a collision with another plugin? If so, can it be solved?

    Thanks.

  48. October 4th, 2005 | 6:44 pm

    Jim,

    There are no such errors under standard conditions, so looking into the errors themselves might give you a clue as to which plugins/files are generating the errors. Beyond that, with the info you have provided, I don’t really know.

  49. October 4th, 2005 | 8:58 pm

    Hi,

    I’m still looking for a fix to the redirection problem mentioned above. I made the code change suggested in a previous posters comment to allow for open registration for users, but now I get a redirection error.

    Any ideas?

    Thanks!
    Martha

  50. November 2nd, 2005 | 12:02 pm

    I’ve tried this and it works great. But a strange thing is that it DOES protect the RSS feeds. I’m trying to still allow RSS feeds to go out, but it doesn’t work because if I enter the RSS URL, it redirects to wp-login.php.

    How can I change this to NOT block my feeds?

  51. November 2nd, 2005 | 1:50 pm

    With the help of PHP guru, we figured this out to enable the RSS to still work. Change the if to:

    if (substr($_SERVER[’SCRIPT_NAME’], -12) != “wp-login.php” && substr($_SERVER[’QUERY_STRING’], -9) != “feed=rss2″) {

    And then the scripts are unsecured and will still work with standard RSS readers.

  52. Arno
    December 12th, 2005 | 10:23 am

    Hi,

    This puglin is exactly what i’m looking for, but wehn i activate it, i have a problem on my page. The following inscription appears : “Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/domainename/httpsdocs/blog/wp-content/plugins/registered-only.php:2) in /home/httpd/vhosts/domainename/httpsdocs/blog/wp-admin/admin.php on line 10

    I don’t know why.
    I use the WP version 1.5.2.
    Thanks for you advice and help.

  53. December 20th, 2005 | 9:45 am

    Any chance that this plugin will work in version 2.0 of WordPress? Has anyone tested Registered Only in WordPress 2.0?

    Would you consider updating this plugin if it doesn’t work in WordPress 2.0?

  54. orange
    December 21st, 2005 | 1:25 am

    hi! i’m new to wordpress so please bare with the ignorance :)
    how do i contain several users to read my blog while the Registered only plugin is activated?

    Thanks :)

  55. leo
    January 24th, 2006 | 10:02 am

    I can’t post via gnome-blog (or blogtk) when the plugin is activated. Deactivating it fixes the problem.
    Is there some workaround to use both?
    Thanks

  56. January 27th, 2006 | 3:41 am

    George, I’ve just installed and the plugin seems to work perfectly with 2.0

    orange, nice name… It’s my surname. The easiest option would be to create logins for the users in the admin panel and provide those to who you’d be sharing your content with.

  57. Anonymous
    February 19th, 2006 | 12:36 pm

    appears to work on wp2.0

  58. msvo
    March 1st, 2006 | 3:45 pm

    Thank you for the pluggin. This is exactly what I need. But I got a problem, on the login page, the register link does not seems to work. It loads the same page again instead of another form to register. Anyone has the same problem? Thanks…

  59. March 18th, 2006 | 2:28 pm

    Works great in WP2.02. Also the register link on the main site still works great. Thanks; realy good, brief and efficient plugin.

  60. Gene
    April 21st, 2006 | 2:57 pm

    It appears that the RSS feed fix provided by DJosephDesign on November 2, 2005 no longers works under version 2. Can anyone confirm that or offer a solution?

  61. May 16th, 2006 | 6:19 pm

    Is there any way to use this plugin to restrict only some posts under some category, but not the whole blog? That should be really awesome, I found some other plugins that can do that, but they either not working well, or not supported for WP 1.5

    Thanks in advance!

    Regards,
    Dario

  62. Sara
    June 1st, 2006 | 11:51 pm

    I wanted to thank you for this plugin.My site had been troubled by trolls but your plugin solved the problem.Much appreciated!

  63. June 7th, 2006 | 8:11 am

    Thanks a lot for the plugin. It’s functionality was exactly what I was looking for.

  64. June 13th, 2006 | 10:53 am

    I was trying to use this on my WP 2.02 blog … and I think it worked fine! That is - until I logged out - I wanted to see if it was truly hidden. It just gave a whole bunch of errors. So, I tried to log back into the blog. It wouldn’t let me access the login page and the blog was lost to me altogether. Fortunately, it was a group blog and another member was still logged in and that person deactivated the plugin.

    I’m now concerned about having the plugin activated. Is there a fix for this? I know this is an old plugin by Carthik and not meant for new WP versions, and all other disclaimers. I need this for a private network blog though. Any suggestions would be helpful. I’ll check back later.

  65. orclwzrd
    July 8th, 2006 | 9:46 am

    Just curious mostly… I’ve added the performancing plugin to firefox and can’t access my wordpress blog thru it. I am running your registered_only plugin and I wonder if that’s the issue… ok, I know that’s the issue, but I would think that it should be able to do the login. If you have any thoughts, drop me an email when you have time. Thanks for the handy plugin!!! Yours was the first one I added!

  66. Scot Hacker
    July 28th, 2006 | 4:20 pm

    Amazed this functionality isn’t part of WordPress core. Thanks for this! However, I’ve just realized that using it makes a blog incompatible with posting clients such as Ecto. Hmmm… I guess this is related to the XMLRPC issues noted above. Would be great if there were some kind of work-around for that.

  67. October 5th, 2006 | 11:21 am

    Carthik, for somereason, i’m unable to use Windows live editor on one of my blogs on which i’m using “Registered Only” plugin. I am unable to add the blog in the live editor when the plugin is enabled and when i disable it, i am able to add the blog and post stuff. How to solve this ploblem when the plugin is enabled and blog is still protected.
    With “Registered only” and Windows live Editor, i get a perfect secret blog.
    if you can solve this issue, please reply to my post here: http://www.gangavalli.com/blog/2006/10/05/playing-with-the-new-windows-live-writer/

  68. DD1
    October 26th, 2006 | 1:57 pm

    It appears that the RSS feed fix provided by DJosephDesign on November 2, 2005 no longers works under version 2. Can anyone confirm that or offer a solution?

    Has anyone found a solution to this? I’m using 2.0.4. Getting feeds in NetNewsWire when plugin is deactivated, but feeds won’t come through when plugin is activated.

    Tried DJosephDesign’s suggestion, adding “wp-rss.php” in place of “feed=rss2″ - which was causing a syntax error because of the ‘=’

    Thanks for any assistance.

  69. January 20th, 2007 | 12:48 pm

    This plugin worked flawlessly — thanks! I spent a couple of hours trying to use another similar plugin to no avail. Your’s worked perfectly.

  70. May 27th, 2007 | 5:55 am

    Thanks! Your plugin is just what I was looking for and it works flawlessly on Wordpress 2.1.2!

  71. Tom
    June 27th, 2007 | 11:04 am

    Thanks alot! It works perfectly with WP2.2.1!

    Hooray for this old one! :D

  72. September 23rd, 2007 | 8:46 am

Leave a reply