[wp-trac] [WordPress Trac] #36302: wp_update_comment needs a filter

WordPress Trac noreply at wordpress.org
Sun Apr 24 17:07:30 UTC 2016


#36302: wp_update_comment needs a filter
-------------------------+------------------------------
 Reporter:  frankiet     |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Comments     |     Version:  4.4.2
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |     Focuses:
-------------------------+------------------------------
Changes (by dshanske):

 * keywords:   => needs-patch


Comment:

 What about replacing:


 {{{
 // Merge old and new fields with new fields overwriting old ones.
     $commentarr = array_merge($comment, $commentarr);
 }}}

 with:

 {{{
     /**
      * Filter the comment before it is updated in the database.
      * By Default, merge the old and new fields with new overwriting old.
      *
      * @since x.x.x
      *
      * @param string $comment The old comment data
      * @param string $commentarr The new comment data
      */
     $commentarr = apply_filter( 'pre_edit_comment', array_merge($comment,
 $commentarr), $comment, $commentarr);
 }}}

 That would basically allow the new comment array to be edited.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36302#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list