[wp-hackers] button patch for comment post section
dmhouse at gmail.com
Fri Oct 7 14:30:54 GMT 2005
On 07/10/05, Owen Winkler <ringmaster at midnightcircus.com> wrote:
> Add a new function comment_error_message(). By default, this function
> echoes a hidden form field, like:
> <input type="hidden" name="commenterrors" value="1" />
Or name="show_comment_errors" or something like that.
> 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.
We'd have to pass the error through the query string anyway, so
comment_error_message() could just do get_query_var('comment_error'),
echo it if it exists, or output the hidden input if not.
> Yeah, that's convoluted.
Not as much as you might think. From a theme designer's point of view,
all that's required is adding a comment_error_message() function to
their comment form. The only inelegance comes from the hidden input
and the forking that would be necessary in wp-comments-post.php to
check whether the hidden input was there, both of which are required
for backward compatability.
-David House, dmhouse at gmail.com, http://xmouse.ithium.net
More information about the wp-hackers