[wp-hackers] button patch for comment post section
Owen Winkler
ringmaster at midnightcircus.com
Fri Oct 7 14:19:17 GMT 2005
David House wrote:
> On 07/10/05, Owen Winkler <ringmaster at midnightcircus.com> wrote:
>
>>WordPress needs a good comb-through for all of those die()-style errors
>>so that they can all be removed and replaced with friendlier, more
>>informative, theme integral responses.
>
>
> +1. We should just redirect back to the comment page, fill in the
> information that they sent, and insert a p, div etc. with a class of
> "error", which themes would style. We could provide a default style
> for themes that didn't bother, something like,
>
> div.error { border: 1px solid #f00; }
Ah, that sounds so easy...
I advocate this style error for everything in the admin that doesn't get
converted to Ajax (or even for those things that do get converted in the
case of a no-javascript failover). But for error messages that would
appear inside a site's theme, this could be difficult, since users are
free to customize that part of the form.
No existing theme would have the requisite new call to some
comment_error_messasge() that would output such an error, and theme
designers would want to be able to style the message and possibly even
alter it entirely.
----
Ok, so here's a totally crazy idea:
Add a new function comment_error_message(). By default, this function
echoes a hidden form field, like:
<input type="hidden" name="commenterrors" value="1" />
If this field is present when the comment is submitted, then when an
error occurs, it reloads the comment page in a way (by passing an
additional "commenterr=1" query value?) that causes
comment_error_message() to output an error in addition to the hidden field.
When the function call isn't present, the commenterrors input value
isn't included in the from, and the comment system die()s like it
currently does.
The parameter of comment_error_message() overrides the default error text.
Yeah, that's convoluted.
Owen
More information about the wp-hackers
mailing list