[wp-trac] [WordPress Trac] #30307: wp_update_comment does not update user_id column
WordPress Trac
noreply at wordpress.org
Mon Nov 10 23:40:50 UTC 2014
#30307: wp_update_comment does not update user_id column
--------------------------+-----------------------------
Reporter: jphase | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
wp_update_comment() does not allow the update of the user_id column. This
is caused from the $keys array on line 2233 of wp-includes/comment.php not
containing the 'user_id' key before wp_array_slice_assoc() is ran on the
following line. It's a very simple fix so I'll be posting a diff to this
here momentarily.
Before the fix:
{{{
$keys = array( 'comment_content', 'comment_author',
'comment_author_email', 'comment_approved', 'comment_karma',
'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_parent'
);
$data = wp_array_slice_assoc( $data, $keys );
$rval = $wpdb->update( $wpdb->comments, $data, compact(
'comment_ID' ) );
}}}
After the fix:
{{{
$keys = array( 'comment_content', 'comment_author',
'comment_author_email', 'comment_approved', 'comment_karma',
'comment_author_url', 'comment_date', 'comment_date_gmt',
'comment_parent', 'user_id' );
$data = wp_array_slice_assoc( $data, $keys );
$rval = $wpdb->update( $wpdb->comments, $data, compact(
'comment_ID' ) );
}}}
Attached is a diff for this that fixed trunk for me. Let me know if I
missed something obvious or am not understanding some basic usage.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30307>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list