[wp-trac] [WordPress Trac] #4721: Password-Protected Post Delivers WAI-Unfriendly Code

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 10 01:25:43 GMT 2007


#4721: Password-Protected Post Delivers WAI-Unfriendly Code
-----------------------+----------------------------------------------------
 Reporter:  cmarshall  |       Owner:  anonymous  
     Type:  defect     |      Status:  new        
 Priority:  normal     |   Milestone:  2.3 (trunk)
Component:  Template   |     Version:  2.2.2      
 Severity:  minor      |    Keywords:             
-----------------------+----------------------------------------------------
 Very simple. The form emitted by the password-protected post (in place of
 the content) does not meet basic WAI guidelines (label associated with
 form element using the for= attribute). Normally, I would rewrite this
 myself, but this is generated by the core (get_the_password_form in post-
 template.php).

 If there is a simple workaround or overload, that would be great. I will
 be trying to figure out if I can overload it, but it does not appear to be
 be possible.

 This isn't actually an easy issue to address, as the label's for attribute
 needs a unique ID, so I am applying the following hack:


 {{{
 function get_the_password_form() {
         $id = "password_".get_the_ID();
         $output = '<form action="' . get_option('siteurl') . '/wp-
 pass.php" method="post">
         <p>' . __("This post is password protected. To view it please
 enter your password below:") . '</p>
         <p><label for="'.__($id).'">' . __("Password:") . ' <input
 name="post_password" id="'.__($id).'" type="password" size="20" /></label>
 <input type="submit" name="Submit" value="' . __("Submit") . '" /></p>
         </form>
         ';
         return $output;
 }
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4721>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list