Page Protection er et plugin for dig, der gerne vil beskytte en eller flere af dine WordPress-sider med brugernavn og kodeord.
Ved hjælp af dette plugin kan du sørge for, at indholdet på siderne og deres undersider kun kan læses, hvis det rigtige brugernavn og kodeord angives. Samtidig bliver undersider skjult i menuer og sidelister, med mindre det rigtige brugernavn og kodeord er blevet angivet, og desuden kan siderne og undersiderne ikke findes ved en søgning, med mindre du eksplicit angivet at de skal kunne findes (dog vil de så kun optræde i søgeresultatlisten med overskrift).
Du kan prøve det af her, på en beskyttet side — brugernavn og kodeord er henholdsvis page og protection.
Læs mere og download seneste version i WordPress’ pluginkatalog.
The password prompt is working though once you enter a password it only shows me the password header “This page is protected with user name and password…” and not my page content. Please advise…
matt,
Sounds strange. Did you also enter a user name?
Which version of WordPress/browser are you using (and which theme, if public)?
Hej,
Jeg har søgt længe efter sådan plugin… men blev fælt skuffet da jeg fandt ud af at den ikke virker.
Der opstår en fejl et eller andet sted, for selvom jeg indtaster det korrekte password og brugernavn, får jeg en besked om at det er forkært…
Noget der er en forklaring på…?
hilsen Svend TT
Svend TT,
Det lyder underligt, men jeg har på fornemmelsen det måske skyldes, at din PHP kører på en speciel måde. Jeg sender dig en ny udgave, med lidt debug-funktionalitet indbygget — prøv at lave en side med brugernavn/adgangskode debug/debug, så vil den forhåbentlig spytte noget ud, du kan sende retur til mig…
What I’d like is to have a list of users defined somewhere, then for certain pages I would only choose some users to be able to access that page. Is there any possibility you might add any functionality like this in the future?
kip,
Page Protection is designed for use by a set of people associated with a site, but not registered as individual users. Thus, it’s quite different from a group of registered user, so I don’t see a feature like that in the future, no. There might be other plugins that would be better suited for that task.
Hi, i’m new at wp, how ever, I don’t find how to apply the plug to a page. And where to define the user/password.
Thaks
The plugin must be activated from the plugin administration page.
Once activated, you should see a new box labelled “Page Protetection” on the edit page for a page. The box contains fields for user name and password.
Thanks for the help.
I have another question though, once I have unlocked the page, it´s acceseble for everyone, have I done anything wrog or is that how it´s supposed to work?
Hi,
Thanks for the great plugin. It’s exactly what I need. Install and implementation was a breeze. However, when I put in my username/password, it’s telling me it’s incorrect, and prompting me to do it again. I’ve tried “debug/debug” and gotten the same results. Any thoughts?
Mike
Are you running PHP in CGI mode? That ususally prevents PHP, WordPress and plugins from getting to the authentification information.
I have a problem with this pluggin which I hope you could fix Morten. When I type the username and password, it just open a new window asking me again for the username and password. Been trying a lot of usernames and passwords but it never accept my login information
Are you running PHP in CGI mode? That ususally prevents PHP, WordPress and plugins from getting to the authentification information, resulting in the prompt being displayed again.
Have you tried the debug/debug trick?
Works fine when you enter the wrong password, but when I cancel the username and password prompt, it still goes to the protected page
That is correct behaviour, it should however display a text along the lines of “no access” instead of the actual content.
Thanks for the plugin.
I was having a problem that it would always “forget” my page protect settings.
After looking at the code I realize why this happened. It is because I created the page first, and later added the plugin to protect the page.
In your code, there is no wp_update_post function, only wp_insert_post. Therefore, my updates never were able to update the protection status after the first time of insertion.
Here is the code I added to the plugin to fix the problem. I think it works ok, at least so far:
function page_protection_update_post($pID) {
delete_post_meta($pID, ‘_page-protection’);
if (isset($_POST['page-protection-on']) && $_POST['page-protection-on'])
update_post_meta($pID, ‘_page-protection’, array(
‘user’ => $_POST['page-protection-user'],
‘pass’ => $_POST['page-protection-pass'],
’searchable’ => isset($_POST['page-protection-searchable'])
)
);
}
add_action(’wp_update_post’, ‘page_protection_update_post’);
This is the exact fix that I was looking for! I’m hoping it will fix the problem, but only time will tell since it will “forget” the password settings after a questionable amount of time. TIA!
Nope, it looks like it didn’t work. I think it has something to do with Wordpress’ autosave feature, because it seems to forget the password whenever the autosave message comes up. I disabled post revisions so I’m hoping that will fix it. So far so good.
Ok, so my “fix” didn’t work. My page still “forgets” its protection regularly.
Do you have any idea why this is happening?
Thanks
Morgan
Sorry! Please ignore my latest post. It actually IS working now, it is just that my browser was remembering the authentication information so I wasn’t seeing the password protection.
However, the code fix I posted above did change behavior for the better. Before, whenever I navigated to the page in question within admin, it would “forget” the previous settings.
Now it always seems to remember them.
Sorry about the multiple posts.
how can I tell if my provider is running as CGI and not mod_php.
This plugin is precisely what I need as well, but I keep getting prompted over and over.
When I create a page with debug/debug it seems trapped in the same loop.
I was able to cancel out and got some output, part of the header response was [GATEWAY_INTERFACE] => CGI/1.1
Assuming that means provider is CGI…
Is there another plugin like yours that will work this way?
Sean,
Yes, it does look like you are running CGI.
And no, I don’t know of an alternative, otherwise I wouldn’t have written this.
ironically, I have a test bed that I run everything through where the plugin works perfectly and also reports the same…
I think something else is going on.
I just ran a sniff on it, the response code that comes back is a 401 on the wire, but that of course is not presented.
Would you expect the server to actually respond with a 401 code vs a hard error if CGI was the issue?
I wonder if the theme is breaking it.
I am trying to find out how to change the message that shows on the prompt. I would like it to say something different. is there an easy way to make this change?
Ken,
Sorry, no, not an easy way, only by changing the plugin “code” itself.
[...] Developer Website [...]
First off, thanks for all your hard work in creating this plug-in. It was exactly what I needed on our site.
Since the installation we have run into two issues:
1) It seems to “forget” to prompt people for the login after a few days and just show them the blank page with the message that it is password protected. By going into the admin area and unchecking then re-checking the password protect box I can ‘Update’ the page and it starts working again
2) if you click “Cancel” when prompted for the username & password there isn’t any way to get it to prompt you again (using Firefox 3.6)
Any suggestions?
MGCC,
I can’t explain nor reproduce what you’re experiencing.
The plugin tries to send reasonable caching headers to avoid situations like those, but apparently without complete success.
Could you tell a little more about the platform (OS/Web Server/PHP/WP) you are using?
Hello! very nice this plugin but isn’t work for me…
any time it ask me the user and password and in the user box appears the website url http://www.XXX.com/“user”
whe I insert the right user/passowrd everytime ask me again neither with the debug/debug.
My blog is in a subdirectory and the url is different of the installation one … may be this?
or the PHP – CGI?
thanks a lot
al
alberto,
I’m not sure what’s going on, but could be a CGI issue, yes.
In the lower left hand corner of my site you’ll see the word “Login” When you click on that, you’ll see that’s where I applied your plugin. The username and password are both “test” but it won’t work for me.
I don’t know anything about PHP or CGI but I love your plugin and it’s exactly what I need. I’m just hoping we can get it to work. Please let me know your thoughts.
Amanda,
For some reason, I get prompted twice when using Firefox. If I cancel on the first one, and enter the right user name and password on the second, I’m allowed through as expected.
With IE I only get one prompt, which I can’t get through.
Either you have some other security measures in place, or the web server (IIS) is misbehaving…
Hey, thanks for share your code.
Works like a charm
just one thing
I want redirect the browser if the user click on Cancel Button,so, i got it using js, but this is not absolutely secure if js is disabled.
do you have a suggestion to do it?
here is my code
function protectpage() {
global $post;
if (!is_protected_page() || is_authorized_protected_page()){
//if is autorized do something on the header
}else{
echo ‘
jQuery(document).ready(function(){
jQuery(”body”).html(”Redirecting…”);
window.location = “‘.get_bloginfo(’wpurl’).’”;
});
‘;
}
}
add_action(’wp_head’,'protectpage’);
Thanks!
Luis,
You could try using the wp_redirect function.
Hi Morten,
i just installed your plugin to test it. Works great! However, rather than just use one username and password, is there anyway to use the existing username and passwords from the Wordpress site?
Shilo
Shilo,
No, not as is.
You could perhaps create a page template that checks whether the user is logged in…
Hello
I am currently putting together my website and I want to add a feature where I can protect my pictures with an password. I am not sure if this the right plug in for me. In other words I just need a plug gin that is going to allow the viewer to put a password when they enter the galleries. (if go to to nathaliekraynina.com is the “COLLECTIONS” tab that I need protected) They don’t have to sign in or give any info just type in the right password. Do you think your pluggin is what I need? I am just starting out I would really appreciate any help/advice you may have. Thanks
Nathalie
Nathalie,
If all you need is a single password (no user name), the builtin WordPress password protection should be fine.
hey Svar,
i find your plugin and look for some time to let it work. after reading the supportpages and questions above it seems some people couldn’t use it because of an error with the username and password. And I must confess it was the same with my site. Finally I adjust an new user and password and it works fine. Before that I used the users and pasword of the users in wordpress. Seems for me the most logic that subscribers uses their own name and password. No? But it works now. I only must people tell them wath the user and pasword is… greatings
For the site http://www.dramaticmoments.co.uk I am trying to make a password protected page, whereby multiple passwords and user names can be set up (around 100) for the following page:
http://www.dramaticmoments.co.uk/index.php/the-course
At the moment there is only one, and this doesnt prove to be very safe. does yours work the same way. Is there a decent plugin for multiple usernames/passwords to be used???? im very lost and dont want to go down the .htaccess route. I just want a simple plugin. does it exist???
Can you please tell me how to make that great plugin work ? I have the latest WP installation, PHP i CGI mode and every time I open the site that is protected, after enteriing the username and password, firefox asks me to type those two again and again …
You can check it here – the site is under developement:
http://piotrpiech.pl/faq/
when I choose cancel, it displays:
This page is protected with user name and password…
Thanks for help!
Piotr