Latest version: 0.1 – Released June 9th, 2009
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 which will log them out of password protected posts when clicked.
Installation
This plugin has only been tested with WordPress 2.7 and 2.8. It may or may not work with older versions.
- Unzip the ZIP file and drop the folder straight into your wp-content/plugins directory.
- Activate the plugin through the 'Plugins' menu in WordPress.
- Add
<?php do_action('posts_logout_link'); ?>somewhere in your theme.
Those people who are logged in to password protected posts will now see a link to log out.
Todo list
- Several things. Will update this list at a later date.
FAQ
I've added the template tag to my theme but can't see the 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: <?php do_action('posts_logout_link','Log out!'); ?>
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
This plugin has only been tested with WordPress version 2.7. It may or may not work with earlier versions.
Version 0.1 ZIP file from downloads.wordpress.org
Any comments, questions, queries, suggestions, complaints, etc, please leave a comment!

June 26th, 2009 at 7:59 pm
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!
June 26th, 2009 at 11:15 pm
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.
June 27th, 2009 at 5:51 am
Thank you, putting it in the footer.php worked perfectly.
Thanks again for this great plugin and I look forward to future releases.
August 16th, 2009 at 4:02 pm
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
August 17th, 2009 at 3:53 pm
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.
August 20th, 2009 at 1:45 am
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! :)
August 27th, 2009 at 9:11 am
Hi
The plugin seems to work great :-) … thanks :-)
//Lars
August 27th, 2009 at 11:41 am
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
November 20th, 2009 at 4:35 pm
This works perfectly! I think this is the only plugin out there that properly addresses this important issue. Thanks!
December 2nd, 2009 at 8:23 pm
Great, thanx :)
January 22nd, 2010 at 4:17 pm
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.
January 22nd, 2010 at 7:38 pm
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.
February 23rd, 2010 at 12:01 pm
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.