[wp-trac] [WordPress Trac] #56244: Use a consistent parameter name for functions accepting a comment ID or object

WordPress Trac noreply at wordpress.org
Thu Jul 21 02:50:56 UTC 2022


#56244: Use a consistent parameter name for functions accepting a comment ID or
object
----------------------------+-------------------------------------
 Reporter:  SergeyBiryukov  |       Owner:  SergeyBiryukov
     Type:  enhancement     |      Status:  accepted
 Priority:  normal          |   Milestone:  6.1
Component:  Comments        |     Version:
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:  docs, coding-standards
----------------------------+-------------------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:14 peterwilsoncc]:
 > [53729] affects the data sent to the `preprocess_comment` filter.
 >
 > Prior to this change the user ID would be sent to the filter both as
 `user_ID` and `user_id` when called from the modified function. After the
 change this is no longer the case.

 Good catch, thanks!

 There was a similar test added for `wp_handle_comment_submission()` in
 [36038] / #34997, but it looks like `wp_ajax_replyto_comment()` does not
 use that function and just calls `wp_new_comment()` directly. It could
 perhaps use `wp_handle_comment_submission()` instead of partially
 duplicating it, but that would be a separate enhancement.

 [attachment:"56244.diff"] fixes the issue in my testing and includes a
 unit test for `wp_new_comment()`.

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


More information about the wp-trac mailing list