[wp-trac] [WordPress Trac] #23870: Filter Glyph for Comment Required Fields

WordPress Trac noreply at wordpress.org
Sat Mar 30 20:00:42 UTC 2013


#23870: Filter Glyph for Comment Required Fields
-------------------------------------+------------------------------
 Reporter:  cais                     |       Owner:
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Comments                 |     Version:  trunk
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+------------------------------

Comment (by cais):

 Replying to [comment:1 SergeyBiryukov]:
 > This seems to work for me:

 To reach a point closer to my OP I would change your snippet to the
 following:
 {{{
 function required_fields_glyph_23870() {
         $glyph = apply_filters( 'comment_required_glyph_23870', '*' );
         return $glyph;
 }
 function change_required_fields_glyph_23870( $defaults ) {
         $defaults['fields']['author']     = str_replace( '*',
 required_fields_glyph_23870(), $defaults['fields']['author'] );
         $defaults['fields']['email']      = str_replace( '*',
 required_fields_glyph_23870(), $defaults['fields']['email'] );
         $defaults['comment_notes_before'] = str_replace( '*',
 required_fields_glyph_23870(), $defaults['comment_notes_before'] );
         return $defaults;
 }
 add_filter( 'comment_form_defaults', 'change_required_fields_glyph_23870'
 );
 }}}

 Usable but still not as clean as having the filter in core. Perhaps this
 can be cleaned up but that would be continuing even further off the idea I
 was suggesting originally of adding one line (the filtered variable) and
 modifying three others.

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


More information about the wp-trac mailing list