WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#38425 closed defect (bug) (fixed)

REST API: Allow comments to be created setting the user_agent parameter

Reported by: rachelbaker Owned by: rachelbaker
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: REST API Keywords: has-patch has-unit-tests commit
Focuses: Cc:
PR Number:

Description

As of WordPress 4.3 the wp_new_comment() function has been updated to allow the comment_agent value to be set when a comment is created. We no longer need to set the value to an empty string.

WP-API Issue: https://github.com/WP-API/WP-API/issues/2786

Attachments (2)

38425.diff (782 bytes) - added by rabmalin 3 years ago.
38425.2.diff (2.9 KB) - added by rachelbaker 3 years ago.
Unit test and schema correction as well

Download all attachments as: .zip

Change History (5)

@rabmalin
3 years ago

#1 @rabmalin
3 years ago

  • Keywords has-patch needs-unit-tests added; needs-patch removed

Patch added.

@rachelbaker
3 years ago

Unit test and schema correction as well

#2 @rachelbaker
3 years ago

  • Keywords has-unit-tests commit added; needs-unit-tests removed

#3 @rachelbaker
3 years ago

  • Owner set to rachelbaker
  • Resolution set to fixed
  • Status changed from new to closed

In 38864:

REST API: Allow comments to be created setting the user_agent parameter.

As of WordPress 4.3 the wp_new_comment() function has been updated to allow the comment_agent value to be set when a comment is created. The comments API endpoint now allows the comment author's user agent to be set when creating a comment.
Also, the readonly property on the author_user_agent parameter in the schema was removed.

Props rabmalin for the initial patch.
Fixes #38425.

Note: See TracTickets for help on using tickets.