For some reason or other, you might want to allow access to certain posts only to certain people. You can use password-protection on Pages and Posts, but those need to be set individually.
It’s far simpler to just write a Post, specify a category and all posts in that category are password protected.
Imagine a family blog where certain posts are only visible to people who know the birthday of your first child, or remember your pet’s name.
Cat-Pass is not for super-sensitive information, it’s for casual use.
Installation is simple:
- Download Cat-Pass
- Unzip
- upload cat-pass.php to yoursite/wp-content/plugins directory
- activate
- customize
Or:
- In your WordPress Dashboard go to Plugins -> Install Plugins
- Search for Cat-Pass
- Install
„Awesome! This plugin is just what I’ve been looking for“
I’m so glad to hear that. I’ve been looking around for a feature such as this one and haven’t found anything similar, so I had to make it myself.
So here it comes: please donate a beer or two if I have been able to make your life easier. It’ll make my feel all warm and fuzzy inside, and you will feel it too.
I really like the simplicity of the cat-pass plugin. It works as expected except that once I type the password and the content is rendered, I get the following error:
Warning: Cannot modify header information – headers already sent by (output started at /home/content/27/5131427/html/wp-content/plugins/cat-pass/cat-pass.php:1) in /home/content/27/5131427/html/wp-content/plugins/cat-pass/cat-pass.php on line 17
…on the resulting page. Line 17 is the setcookie call in the init function cat_pass_cookie.
Any ideas?
Hmm, I need to look into this.
I don’t have this error. What Version of WP are you using?
Hi Daniel —
Sorry I didn’t include that. WordPress 3.5.1 It looks like at least one other person in your forum has the same issue. I suspect calling setcookie before any header output leads to this error… at least in 3.5.1. I ended up, temporarily anyway, using this hack in my theme’s functions.php. This leaves the setcookie work to the action target of the get_the_password_form(). This will only work for the newest versions of wordpress due to the cookie hashing that’s been recently added. However, I could quickly write up a version that works for older wordpress too if you’re interested. I prefer to use your plugin since it has such a nice configuration interface instead of hardcoded values in my hack.
add_action( ‚wp‘, ‚category_protect‘ );
if ( ! function_exists( ‚category_protect‘ ) )
{
function category_protect() {
global $post;
if ( ! is_single() ) return false;
if ( empty( $wp_hasher ) ) {
require_once( ABSPATH . ‚wp-includes/class-phpass.php‘ );
// By default, use the portable hash from phpass
$wp_hasher = new PasswordHash(8, true);
}
$password = ‚mysecretpassword‘;
$protected_categories = array(‚password-protected-category‘);
$stored_hash = stripslashes( $_COOKIE[ ‚wp-postpass_‘ . COOKIEHASH ] );
if ( in_category( $protected_categories, $post->ID ) && ! $wp_hasher->CheckPassword( $password, $stored_hash ) )
{
$post->post_content = get_the_password_form();
}
}
}
In my previous post I mentioned other posts in „your forum“ I mean’t the wordpress support forum for the cat-pass plugin:
http://wordpress.org/support/topic/error-in-wordpress-35
Hi!
I’m running your Cat-Pass plugin on my WordPress website and it’s just perfect, thank you!
I’m running WP 3.5.1. Now I have made an external page for mobiles which fetches a passwordprotected catagory and that’s works great. But for some reason i can’t get the password to be saved in a cookie so i have to type it in every time.
Can you please help me?
Hi. your plugin is what I need.
But, It’s possible to use the SAME password for ALL categories ?
It seems not work.
Thanks
Davede
Tell me how to put on each category unique password?
Not possible, only one password for one category.
No, sorry, it’s only possible to use one password for one category.
It is a limited plugin I basically did for a special case and then gave to the world. And since nobody’s paying me to keep working on it … I can’t take it any further, sorry.
You might want to look into using .htaccess to add a password to all your posts. You can use permalinks to create a „directory“ for your posts and set in the .htaccess file that this directory requires identification.
Hope it helps.
The cookie-setting portion of the code is faulty or outdated, as someone pointed out to me.
I don’t really have time or energy to continue development and, to be honest, I think I even forgot how to get my plugin into the WP Plugin Repository.
Seeing a bunch of comments here, I think I will take another whack at it but that won’t be for another few weeks. Hope you can wait that long, and I hope I can fix it.
Thank you,Roger.
I want to look into my plugin again in a few weeks‘ time. If it’s not yet too late, or you want to use my plugin as a base to publish your own, feel free to use it. (well … please credit me when you do 🙂
I can see future versions supporting multiple categories and multiple passwords.
But only 600something downloads might not be worth the effort. Especially since I did not receive one single buck in donations and that is kind of depressing.
Well, I like super-simplicity of Cat-Cass and I made a donation also!
Just a quick information: if I protect a category ex. „reserved“, does it mean that all sub-categories under „reserved“ are protected too???
Thank you.
Simone
please can you change the unlock button to english please then 5 star thanks
I don’t have the time to edit the plugin anymore.
But it is simple to do all by yourself: find the file „cat-pass.php“ inside the cat-pass plugin folder. Edit it with a text editor (make a backup first!), then find the bits of text you want to change and voilá!
Hi – since installing this plug in I can’t log in to the dashboard, and get these error messages. Do you know how I can get in the back end to disable the plug in ?
I appreciate it’s a project that you’ve dropped but I’m new to WP and currently have a very broken website !
Thanks in advance,
Rebecca
I don’t know if this reaches you in time … but whenever you have a problem with a plugin, just log in via FTP and rename the offending plugin folder. You will then disable it and your site can get back to normal.
To everyone worrying about replacement of this plugin, please consider
https://nl.wordpress.org/plugins/access-category-password/
Ger