Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Ok guys, I'm building a page, where a certain sub-page is password protected. Easy in wordpress. But there is a UX problem: when a user enters a wrong password, theres no error message or something to indicate, that the password is not correct.

Is it posible to manually code it somehow to the template file?

share|improve this question
    
Show your code...then only we able to give answers –  Ramkumar Jul 1 '11 at 10:49
add comment

1 Answer 1

not really, but can try something like:

add_action('wp', 'check_post_pass');

function check_post_pass(){

  if(!is_single() || !post_password_required()) return;

  global $post;
  if(isset($_COOKIE['wp-postpass_'.COOKIEHASH])
      && $_COOKIE['wp-postpass_'.COOKIEHASH] !== $post->post_password){

    define('INVALID_POST_PASS', true);

    // tell the browser to remove the cookie so the message doesn't show up every time
    setcookie('wp-postpass_'.COOKIEHASH, NULL, -1, COOKIEPATH);
  }

}   

in your template:

if(defined('INVALID_POST_PASS')) _e('The password you entered is funky');

But a much better idea would be to create your own the_content()-like function and password form + check function, without cookies...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.