Opened 19 years ago
Closed 18 years ago
#4721 closed defect (bug) (fixed)
Password-Protected Post Delivers WAI-Unfriendly Code
| Reported by: | cmarshall | Owned by: | Nazgul |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.5 |
| Component: | Template | Version: | 2.2.2 |
| Severity: | minor | Keywords: | has-patch |
| Cc: | Focuses: |
Description
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;
}
Attachments (2)
Change History (7)
#1
follow-up:
↓ 2
@
19 years ago
- Keywords has-patch added
- Owner changed from to
- Status new → assigned
#2
in reply to: ↑ 1
@
19 years ago
Replying to Nazgul:
Patch adds a unique id to the label based on the given post id.
It uses a random value if no post id is given for backwards compatibility.
Interesting patch.
Could we not use the global $ID if one is not passed and assume we are in "the loop"?
Having to put all that conditional code in the template looks a bit bad as well - but I guess that is something for another ticket ;-)
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Patch adds a unique id to the label based on the given post id.
It uses a random value if no post id is given for backwards compatibility.