Allow comment_post_ID to be passed to wp_update_comment(), so that a comment can be moved to a different post.

Props tyxla, rachelbaker

Fixes #30946


Built from https://develop.svn.wordpress.org/trunk@31195


git-svn-id: http://core.svn.wordpress.org/trunk@31176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2015-01-16 02:39:23 +00:00
parent 9ee49b130c
commit b74f13511a
2 changed files with 8 additions and 2 deletions

View File

@ -2205,6 +2205,12 @@ function wp_update_comment($commentarr) {
if ( empty( $comment ) ) {
return 0;
}
// Make sure that the comment post ID is valid (if specified).
if ( isset( $commentarr['comment_post_ID'] ) && ! get_post( $commentarr['comment_post_ID'] ) ) {
return 0;
}
// Escape data pulled from DB.
$comment = wp_slash($comment);
@ -2239,7 +2245,7 @@ function wp_update_comment($commentarr) {
$comment_ID = $data['comment_ID'];
$comment_post_ID = $data['comment_post_ID'];
$keys = array( 'comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_type', 'comment_parent', 'user_id' );
$keys = array( 'comment_post_ID', 'comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_type', 'comment_parent', 'user_id' );
$data = wp_array_slice_assoc( $data, $keys );
$rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-alpha-31194';
$wp_version = '4.2-alpha-31195';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.