[wp-trac] [WordPress Trac] #15015: Customisable submit button for comment form

WordPress Trac wp-trac at lists.automattic.com
Sat Oct 2 16:38:10 UTC 2010


#15015: Customisable submit button for comment form
-------------------------+--------------------------------------------------
 Reporter:  morpheu5     |       Owner:                             
     Type:  enhancement  |      Status:  new                        
 Priority:  normal       |   Milestone:  Awaiting Review            
Component:  Comments     |     Version:  3.0.1                      
 Severity:  blocker      |    Keywords:  submit button markup custom
-------------------------+--------------------------------------------------
 Note: I'm setting this as a blocker because it is a blocker '''to me'''.
 Set it whatever you feel appropriate.

 I badly needed to customise the submit button because I wanted to add a
 tabindex.

 I could reimplement the whole form with my markup, but as I already worked
 my way through all the other fields, I did want to continue this way.

 Sadly I discovered it's not possible. So, after discussing this in IRC, I
 decided to hack the core and propose the attached patch.

 Basically now you can create a filter and output your markup, like this:

 {{{
 function awesome_comment_form_submit_button($button) {
         $button =
                 '<input name="submit" type="submit" class="form-submit"
 tabindex="5" id="[args:id_submit]" value="[args:label_submit]" />' .
                 get_comment_id_fields();
         return $button;
 }
 add_filter('comment_form_submit_button',
 'awesome_comment_form_submit_button');
 }}}

 and filter magic happens. Please notice that
 1. you have to include [args:id_submit] and [args:label_submit] if you
 want the comment_form() parameters to work.
 2. you have to use the get_comment_id_fields() function.

 It may be better but it works for me. If anybody feels like making it
 better, be my guest.

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


More information about the wp-trac mailing list