Ticket #23231: 23231.2.diff
File 23231.2.diff, 1.4 KB (added by , 9 years ago) |
---|
-
wp-includes/comment.php
1730 1730 * @return int The ID of the comment after adding. 1731 1731 */ 1732 1732 function wp_new_comment( $commentdata ) { 1733 if ( isset( $commentdata['user_ID'] ) ) { 1734 $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID']; 1735 } 1736 $prefiltered_user_id = $commentdata['user_id']; 1737 1733 1738 /** 1734 1739 * Filter a comment's data before it is sanitized and inserted into the database. 1735 1740 * … … 1740 1745 $commentdata = apply_filters( 'preprocess_comment', $commentdata ); 1741 1746 1742 1747 $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID']; 1743 if ( isset( $commentdata['user_ID']) )1748 if ( isset( $commentdata['user_ID'] ) && $prefiltered_user_id !== (int) $commentdata['user_ID'] ) { 1744 1749 $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID']; 1745 elseif ( isset($commentdata['user_id']) )1750 } elseif ( isset( $commentdata['user_id'] ) ) { 1746 1751 $commentdata['user_id'] = (int) $commentdata['user_id']; 1752 } 1747 1753 1748 1754 $commentdata['comment_parent'] = isset($commentdata['comment_parent']) ? absint($commentdata['comment_parent']) : 0; 1749 1755 $parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : '';