Office
Windows
WordPress
Question: (System) How to use the secure password-locked page (Jun 5, 2012; June 26, 2012)
Answer:
Please deactivate the following custom filter because the password locked page cannot be unlocked due to the change of the password unlocking process in WordPress 3.4.
– Related information: Cannot work under Password Lock page in “WordPress HTTPS” forum.
First of all, you need to build the SSL system (https).
Wordpress has the issue that the password lock function does not work when the site url is changed.
Because the action url of the password-locked input form uses “site url”.
For example, I explain in case of using “Secure post” function in “WordPress HTTPS” plugin.
- Change http:// to https:// by “Secure post” function in “WordPress HTTPS” plugin.
- But, the password-locked input form is still “http://”.
- Therefore, even if the password is inputted, anybody cannot access to the secure pages.
I’d like to explain more concretely.
- Access to http://sample.com/test (password-locked page)
- Change to https://sample.com/test automatically
- Display the input password page.
- Input Password and click on “Send” button.
- Run http://*******/wp-pass.php, but cannot access to http://sample.com/test because the page is in https://sample.com/test.
As a result, I could implement to overwrite my_password_form() in wp-includes/post-templete.php.
By overwriting the function, please add the following php code to the function.php in your theme.
/** Overwrite the password lock form in wp-includes/post-templete.php
*
* @ Kimiya Kitani (kitani@cseas.kyoto-u.ac.jp) June 5, 2012
*
* By adding the function, you can use the secure password lock page with "Wordpress HTTPS" plug-in.
*/
function my_password_form() {
global $post;
$label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
// If the page is equipped with SSL (https), the action url of the password lock form changes to https link.
if(function_exists('is_ssl') && is_ssl())
$site_url = get_site_url(null, '', 'https');
else
$site_url = get_site_url(null, '', 'http');
$output = '
' . __("This post is password protected. To view it please enter your password below:") . '
';
return $output;
}
add_filter( 'the_password_form', 'my_password_form' );
© Kimiya Kitani
// ツールのShortcode Exec PHP に作成した新たなショートコード
// http://ja.forums.wordpress.org/topic/1269 を参照に作成
?>