Make WordPress Core

Ticket #23231: comment.diff

File comment.diff, 801 bytes (added by dkotter, 10 years ago)
  • wp-includes/comment.php

     
    17301730 * @return int The ID of the comment after adding.
    17311731 */
    17321732function wp_new_comment( $commentdata ) {
     1733        // normalize user_ID before sending to the preprocess_comment filter
     1734        // this way, anything hooked to the filter won't have to do this themselves.
     1735        if ( isset( $commentdata['user_ID'] ) ) {
     1736                $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
     1737        } elseif ( isset( $commentdata['user_id'] ) ) {
     1738                $commentdata['user_id'] = (int) $commentdata['user_id'];
     1739        }
     1740
    17331741        /**
    17341742         * Filter a comment's data before it is sanitized and inserted into the database.
    17351743         *