Make WordPress Core

Ticket #23231: 23231.diff

File 23231.diff, 1.2 KB (added by dkotter, 9 years ago)
  • wp-includes/comment.php

     
    17301730 * @return int The ID of the comment after adding.
    17311731 */
    17321732function wp_new_comment( $commentdata ) {
     1733        if ( isset( $commentdata['user_ID'] ) ) {
     1734                $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
     1735        }
     1736
    17331737        /**
    17341738         * Filter a comment's data before it is sanitized and inserted into the database.
    17351739         *
     
    17401744        $commentdata = apply_filters( 'preprocess_comment', $commentdata );
    17411745
    17421746        $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
    1743         if ( isset($commentdata['user_ID']) )
    1744                 $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
    1745         elseif ( isset($commentdata['user_id']) )
     1747        if ( isset( $commentdata['user_id'] ) ) {
    17461748                $commentdata['user_id'] = (int) $commentdata['user_id'];
     1749        }
    17471750
    17481751        $commentdata['comment_parent'] = isset($commentdata['comment_parent']) ? absint($commentdata['comment_parent']) : 0;
    17491752        $parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : '';