[wp-trac] Re: [WordPress Trac] #4332: Unusable comment error pages

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 15 01:11:26 GMT 2009


#4332: Unusable comment error pages
--------------------------+-------------------------------------------------
 Reporter:  foolswisdom   |       Owner:  markjaquith                                                    
     Type:  defect (bug)  |      Status:  assigned                                                       
 Priority:  normal        |   Milestone:  2.8                                                            
Component:  General       |     Version:  1.5                                                            
 Severity:  normal        |    Keywords:  comment error page usability dev-feedback 2nd-opinion has-patch
--------------------------+-------------------------------------------------
Changes (by shamess):

  * keywords:  comment error page usability dev-feedback 2nd-opinion =>
               comment error page usability dev-feedback
               2nd-opinion has-patch


Comment:

 I decided to try fixing this myself, just to see if I could. Turns out I
 sort of have it; on comment submit, instead of using wp_die() to give the
 error messages, I just redirected back to the post, passing it an error
 code. That error code is rendered by the action "comment_form_errors"
 which template designers will have to implement themselves.
 "comment_form_errors" echos the error text.

 This doesn't use javascript at all, so there's no problem with worrying
 about them having it disabled. I figured Javascript should supplement a
 server side error response, not entirely replace it anyway.

 There are a few things that I don't like about this way though:

   - It relies on the template designer to add the action before the poster
 can see their errors. A lot of themes being used are orphaned now, and
 likely won't ever get updated again. Changing the WordPress source to use
 this method would abandon all those who don't update their themes, or
 whose themes aren't updated.
   - It uses a GET variable, which generally makes the URL look ugly. I
 wouldn't say that's a majour problem though.
     -  Sending the data as a POST would require the use of curl, a library
 that isn't switched on in PHP by default and so isn't suitable to use in
 WordPress
     -  I tried holding this data in a session, but that didn't work for
 some reason...
   - It echos, rather than returns. That makes it harder for theme
 developers to work with the data it returns.
   - On the redirect back, all the comment fields are blank again. This
 could be hugely annoying if the user just spent an hour writing an awe
 inspiring comment, only to accidentally have left out their email address,
 and lose the comment. This is a problem mostly causes by me not knowing
 how to best transfer data from wp-comments-post.php back to the post.

 PS. This is my first time submitting anything to an open source project,
 so this is more a learning experience for me rather than me aiming to add
 an awesome contribution. If I've done something wrong in the way of
 submitting this, or I've done bad open source coding conventions, email me
 please at (it may be a bit off topic in here): shamess at gmail dot com.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/4332#comment:9>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list