This plugin simply adds a logout button to the content of any password protected post. Sometimes clients want a password protected page to share information with privileged individuals and the default 10 days for the cookie to expire is too long for their liking. So I wrote a little plugin to do this with AJAX and set the cookie to expire immediately, well actually 10 days in the past.
- Works logged in or out as a WordPress user.
- Uses the same functionality WordPress uses to set post cookies.
- Has a simple settings page to make everything easier.
- Allows you to alert user they have logged out.
Imagens de tela
- Ative o plugin por meio do menu “Plugins” no WordPress
- Customize your settings.
- Confirm it is working & you’re done!
Does your theme have
<?php wp_head(); ?>and
Well, this button is setup to be no intrusive on your theme, so it adapts to the styles that come with you theme.
That being said, you can style the button as you wish using a css class you define on the settings page, or add your themes button class.
Well that logout button gets added to the function
the_content()but only when the function
in_the_loop()returns true (as of version 1.2).
if your theme is using
apply_filters('the_content', $some_str);it is possible it will show up more than once.
Colaboradores e desenvolvedores
“Protected Posts Logout Button” é um software com código aberto. As seguintes pessoas contribuíram para este plugin.Colaboradores
Traduzir “Protected Posts Logout Button” para o seu idioma.
Interessado no desenvolvimento?
Navegue pelo código, dê uma olhada no repositório SVN ou assine o registro de desenvolvimento via RSS.
Registro de alterações
- Fixed vulnerabilities in option saving function, not allowing unescaped user input and checking user role
- Tested with WordPress 6.1.1
- Added nonce verification for updating options.
- Tested with WordPress 5.2.2
- Added option for positioning button after content.
- Tested with WordPress 5.1.1
- Added support for multisite by adding COOKIE_DOMAIN to the logout function. Thanks to @rcreactor, @gahapati, and @gserafini
- Tested with WordPress 5.0.3
- Added filters
pplb_button_htmlfor manipulating text and HTML button output.
- Added an option for changing the button text
- re added the function
pplb_logout_buttonto fix potential PHP errors
- Refactored code into a class
- Moved the options page to a template
- Tested with version 4.4.2
- Checking to see if logout cookie option is numeric
- Added a optional debug to the send response to the console.log function ( only for debugging use should not be used in production. )
- Added a check to see the
messageis not of type “undefined”
- Added an option to the options page for turning on or off debug.
- Tested with version 4.0!
- Added the ability to change the default WordPress postpass cookie in the admin area.
- Cleaned up some logic and php code.
- Added conditional logic to the allow admin to disable the automatic filter.
- Added a shortcode to allow users to place the button inside posts and a php function to place it in template files or hook it.
Added conditional logic to the filter to only add the button inside of the loop.
Original Release: uses
wp_enqueue_scripts and ajax to logout password protected posts by setting the cookie to expire immediately.