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’);
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.