Latest version: 0.2 – Released November 3rd, 2012
Description
There is no built-in way for your visitors to "log out" of password protected posts once they've entered the password. Even logged in users cannot log out of password protected posts by logging out of their account. This plugin solves that problem by providing a link for your visitors to log out of password protected posts.
After installing the plugin, add somewhere in your theme to display a link for logging out of password protected posts.
Installation
You can install this plugin directly from your WordPress dashboard:
- Go to the Plugins menu and click Add New.
- Search for Logout Password Protected Posts.
- Click Install Now next to the Logout Password Protected Posts plugin.
- Activate the plugin.
- Add
somewhere in your theme.
Those people who are logged in to password protected posts will now see a link to log out.
For manual installation, see the guide to Manually Installing Plugins.
FAQ
I can't see a link to log out. What's up?
Have you added the template tag somewhere in your theme? You need to add somewhere in your theme for the link to show up.
I've added the template tag to my theme but I can't see the log out link. What's up?
Ensure that you have entered a password for a password protected post. The link will not show up if you're not logged into a password protected post.
Can I change the default text in the link?
Sure. Add a second parameter to the template tag with the text you'd like instead. For example:
For those who want even more control, you can also add a third paramter which will be used as the class name on the link element.
Download
Version 0.2 ZIP file from downloads.wordpress.org
Any comments, questions, queries, suggestions, complaints, etc, please leave a comment!
Sorry to ask such a noob question but what do you mean by “Add somewhere in your theme.”?
This is a feature I could REALLY use but can’t figure out how to implement it.
I installed the plugin and see it in my plugin directory. I then tried pasting that code into the password protected page in wordpress but (as you might have guessed) didn’t work.
I am comfortable editing the theme filed but do I put into sidebar.php or into a .css file?
Thanks for your time and for this great plugin!
Gabriel: Where would you like the log out link to show up? I find that the best place is near the WordPress log out link which is in the sidebar on most themes.
Try adding the code somewhere in
sidebar.php
. If your sidebar uses widgets it might not show up, so if not, try adding it tofooter.php
.Remember you have to be “logged in” to a password protected post in order for the link to even show up, so make sure you’ve entered a password to a post when you check for the link. Once you’ve got the link to show up, you can then experiment with its placement.
I know this isn’t the simplest of solutions, and when I have the time I’ll be adding an automatic insertion option to the plugin to make it easier in the future.
John.
Thank you, putting it in the footer.php worked perfectly.
Thanks again for this great plugin and I look forward to future releases.
John,
I tried adding the code in both the sidebar.php and footer.php and it just shows the raw code. I have the newest version of WordPress, 2.8.4, so I’m not sure if this matters.
Thanks,
Sandra
Hi, your plugin works great. I just miss a function for entering an wrong passwort. If you enter a wrong password now, the “Protected Article”-Message does not change, but the Logout-Button appears anyway. This might be a little confusing for the visitor. A message like “wrong password, please try again” would be better.
Carsten: Nice idea. Something notifying the visitor of an incorrect password should definitely be in WordPress as standard. I might see about adding it to this plugin if I get the time, but don’t hold your breath! :)
Hi
The plugin seems to work great :-) … thanks :-)
//Lars
I wanted to thank John for helping me out after I had posted a message stating that I was having problems installing the plugin. John responded quickly and I was able to get the plugin working….plus John provided some helpful tips regarding other plugins that may be useful on my website. And yes, the plugin works great!
Thanks John,
Sandra
This works perfectly! I think this is the only plugin out there that properly addresses this important issue. Thanks!
Great, thanx :)
Hi there,
Thanks for writing this plugin! I just wanted to let you know that I was also having a problem with the link showing up even if the password was incorrect. I solved it by having it check the cookie’s value against the post password rather than just checking if it’s set. It seems to be great now – thanks for a great start to a plugin.
Helen: Thanks for the comment! I seem to recall there was a reason I didn’t make the plugin check the cookie against the password, but I can’t remember why. I’ll see about updating the plugin soon to address this issue.
This is a great plugin, and something I was looking for. One possible addition would be to be able to change the text for the logout, without having to find it in the code. Simple admin option for this would be great.
Another possible addition would be once logged out, redirect to a certain page / homepage so you can say where you want to be redirected.
But great plugin.
John,
Thanks for the plugin. This solution does allow the use of PWP page and not have it/them going around cocked all the time. “.)
I’m curious though, as to why you didn’t code it so that once either:
1: the person – moves to or opens – another page in the site
2: the page is closed
3: the blog is closed
4: the browser is closed
the PWP page reverts to a LOGIN required status. IE, auto-logout.
Is there a reason for WHY this was not done?
Or is there something I could add to the PHP code to cause an auto-logout?
Thanks again. ‘Tis far better than no logout at all!