Page Restrict WordPress Plugin

14 Aug 2008 11:35:24 EDT | Plugins, Wordpress | By: Matt

Restrict certain pages to logged in users

This plugin will allow you to restrict all, none, or certain pages to logged in users only.

In some cases where you are using WordPress as a CMS and only want logged in users to have access to the content or where you want users to register for purposes unknown so that they can see the content, then this plugin is what you are looking for.

Simple admin interface to select all, none, or some of your pages. This does not work for posts, only pages.

Version Information

Version: 1.6
Requires WordPress Version: 2.6
Compatible up to: 2.9
Last updated: 12 Mar 2009

Screenshots

  1. pagerestrict screenshot 1

    Login Form

  2. pagerestrict screenshot 2

    Admin Page

Installation

  1. Upload the pagerestrict folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress

NOTE: See "Other Notes" for Upgrade and Usage Instructions as well as other pertinent topics.

Upgrade

  1. Deactivate the plugin through the 'Plugins' menu in WordPress
  2. Delete the previous pagerestrict folder from the /wp-content/plugins/ directory
  3. Upload the new pagerestrict folder to the /wp-content/plugins/ directory
  4. Activate the plugin through the 'Plugins' menu in WordPress

Usage

  1. Visit Settings>Page Restrict in the admin area of your blog.
  2. Select your restriction method (all, none, selected).
  3. If you chose selected, select the pages you wish to restrict.
  4. Enjoy.

Download

Downloaded: 4,330 times
Page Restrict version 1.6
Archived and Development Versions

Possibly Related Posts:


Comments

  1. Toby says:

    Hello!
    I am using WP 2.6 with a custom theme, and the plug-in doesn’t seem to have any effect. When I switch over to the “Copyblogger” theme, the plugin works great. Is there a WP function call that is required for this plugin to work (perhaps one that I left out of my custom theme)?

    Here is the url that is currently set to require login with your plugin: http://www.themightymo.com/testblog3/members/

    Thanks!

  2. Matt says:

    @Toby: This plugin hooks into the_content. In page.php of your theme you should have something similar to <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>

    As long as this is used to display the page content then this plugin should work. See http://codex.wordpress.org/Template_Tags/the_content for more information about the_content.

  3. Tom Usher says:

    Hello Matt,

    I loaded Page Restrict 0.3 and activated it. Everything seemed fine. However, the next day, I attempted to visit my site’s index page (WordPress 2.6.1 http://www.realliberalchristianchurch.org/wordpress) while not logged in. I received the following error:

    Fatal error: Call to undefined function: date_default_timezone_get() in [...]/html/wordpress/wp-content/plugins/pagerestrict/pagerestrict.php on line 59

    By trying different combinations of being logged in and not with the plugin activated and not and by clearing my blog cache each time, I discovered that my site was blocked to everyone not a logged-in user. It’s a little unsettling to realize that all the Friday and Saturday traffic to the site has been lost, but that’s how it goes. I’m just glad I caught it as soon as I did.

    I had not changed the default setting in the plugin. No pages were selected. I had simply downloaded and activated in anticipation of users with whom I will want to share inside information.

    The plugin’s concept is good. The settings interface looks clean and well organized. I won’t to use your plugin. I’d like to see different settings for each page depending upon the WordPress role of the user too.

    I hope this information helps you. If you’d like me to test a patched version, I’m willing. Just email me, and I’ll get back to this.

    Thanks,

    Tom Usher

  4. Matt says:

    @Tom Usher: I had not intended on making the plugin PHP4 compatible since PHP4 is now end of life. However, the fix to make this plugin PHP4 compatible made me clean up some code. With that being said, the plugin should now work with PHP4. I have published the fixes and they can be downloaded from the WordPress plugins site or from the links above.

  5. Tom Usher says:

    That was quick! Thanks!

    I tried to get my server to handle PHP5 and to actually handle both, but I’m on GoDaddy, and it won’t accept the patch. Yours is the second plugin that I’ve run into where PHP5 would have been better to be using.

    I’ve forgotten what it was I did in attempting to get both 4 and 5 to work depending, but I’m sure I can find it again. I should probably make a request to GoDaddy to make it possible. I don’t know what their security concerns are with it.

    By the way, since I brought them up, GoDaddy has much bad press out there. I really haven’t found them to be difficult to work with or unresponsive, etc. Every problem I’ve had has been clean up fairly quickly and politely so, I might add. In fact, I really like it that they seem to be free-political-speech oriented. I digress. Thanks again. If you don’t hear from me, the update worked. I’m sure it will.

    God bless.

  6. Toby says:

    Thanks Matt! That is exactly the info I needed. I am using “the_excerpt()” on the page in question. :)

  7. Matt says:

    @Toby: I hadn’t anticipated there being the possibility of using the_excerpt on a page. Perhaps it would be a good idea for me to add the_excerpt to the plugin as well.

  8. Rajiv says:

    After trying various plugins, this seems just the write one.

  9. Hi Matt,

    Your plugin works great.

  10. Bao says:

    Hi Matt,

    Your plugin is awesome!
    The only thing that it doesn’t seem to lock non-subscribers out from are the pages that load up php commands from quicktags, suchas EasySMS’ registration form.

    Also, do you offer anything like this but for posts?
    I’m looking to lock out non-subscribers from certain categories.

    If you or anyone here have a solution then please let me know.

    Thanks a million,
    Bao

  11. Jgcastellano says:

    Hi,
    BUG: I you use the WordPress search, you can access to page-restricted contents.

    By the way, your plugin is a very useful tool.

    Thanks!!

    • Matt says:

      @Jgcastellano: I am aware of this and it has already been fixed in the development version that I hope to release soon. Keep an eye out for the release.

      • Jgcastellano says:

        My temporal solution was to use the “Simply Exclude” plugin, so WordPres doesn’t search in the pages that I had chosen.But, right now, with the 1.6 version, works perfect whithout it.

        Thanks a lot!!!

Leave a Reply




Please place code inside of <code></code>.

Please do not post support or bug type discussions for WordPress plugins here. Support type discussions for WordPress plugins should be posted at http://forum.sivel.net/.

Comments are moderated and may not be approved or may be modified if they contain support discussions.