WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#30627 closed enhancement (fixed)

Fails to update comment type using wp_update_comment

Reported by: desaiuditd Owned by: SergeyBiryukov
Milestone: 4.2 Priority: normal
Severity: normal Version: 2.0
Component: Comments Keywords: has-patch
Focuses: Cc:

Description

New changes for #12668 introduces comment_type for comments in WordPress.

When we add a new comment using wp_insert_comment, comment_type parameter works perfectly. It inserts a new comment with given comment type.

But when we tried to update the same comment with another comment type, the wp_update_comment function ingnores the comment_type parameter.

Root Cause :
Line : 2237 in wp-includes/comment.php gathers all the valid keys for comment manipulations. Overthere comment_type key is not added and further it will ignore the comment_type parameter while updating the comment.

Attachments (1)

30627.patch (823 bytes) - added by desaiuditd 7 years ago.
update comment type patch for #30627

Download all attachments as: .zip

Change History (13)

@desaiuditd
7 years ago

update comment type patch for #30627

This ticket was mentioned in Slack in #core by desaiuditd. View the logs.


7 years ago

#2 @desaiuditd
7 years ago

  • Keywords has-patch dev-feedback added

#3 @johnbillion
7 years ago

  • Keywords dev-feedback removed
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from trunk to 2.0

Confirmed. See also #30307.

#4 @desaiuditd
7 years ago

Shouldn't this go with the next 4.1 release since I'm assuming this to be a major change for comments module and any developer would expect this to work if they are updating a comment_type.

For example, in a plugin that I'm developing, I'm using WP_Comments for followups and each followup has its type let's say, Public & Private followup. Now comment author can change the type of his own followup. So he would just change the type from the UI that I've provided on the front-end and in the back-end I'm changing the comment type using wp_update_comment.

So I think this is a valid case.

#5 @boonebgorges
7 years ago

Shouldn't this go with the next 4.1 release since I'm assuming this to be a major change for comments module and any developer would expect this to work if they are updating a comment_type.

This is a reasonable request, but it's not a regression in 4.1. wp_update_comment() was introduced in r2894 and has never updated 'comment_type'. And while the flexibility of 'comment_type' is improved in r30096, it has been around for far longer.

#6 @desaiuditd
7 years ago

I don't think this should make any ripples even though it has been around for far longer. (9 years .. Ah ! I can only imagine.)

I strongly believe this should go in 4.1, as it was supposed to be a part of r30096. If it would have been included there was not a question at all.

This ticket was mentioned in Slack in #core by desaiuditd. View the logs.


7 years ago

#8 @boonebgorges
7 years ago

  • Type changed from defect (bug) to enhancement

I strongly believe this should go in 4.1, as it was supposed to be a part of r30096. If it would have been included there was not a question at all.

What you're requesting here is an enhancement to wp_update_comment(). I'm not opposed to it, and I'm happy to look at it for 4.2. But it's only peripherally related to r30096, and in any case, it's far too late in the cycle to consider any more enhancements for 4.1.

#9 @desaiuditd
7 years ago

Hmm. Makes sense. Will look forward to 4.2 then. :)

#11 @SergeyBiryukov
7 years ago

  • Milestone changed from Future Release to 4.2

#12 @SergeyBiryukov
7 years ago

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

In 31171:

Add 'comment_type' to the list of fields wp_update_comment() can update.

props desaiuditd.
fixes #30627.

Note: See TracTickets for help on using tickets.