WordPress.org

Make WordPress Core

Changeset 35435


Ignore:
Timestamp:
10/29/2015 09:28:39 PM (5 years ago)
Author:
johnbillion
Message:

Correctly populate the user_id field for comments when a user submits a comment while logged in.

Props imath
Fixes #34493

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-functions.php

    r35339 r35435  
    27432743        $comment_author_email = $user->user_email;
    27442744        $comment_author_url   = $user->user_url;
     2745        $user_id              = $user->ID;
    27452746        if ( current_user_can( 'unfiltered_html' ) ) {
    27462747            if ( ! isset( $comment_data['_wp_unfiltered_html_comment'] )
     
    27792780        'comment_type',
    27802781        'comment_parent',
    2781         'user_ID'
     2782        'user_id'
    27822783    );
    27832784
  • trunk/tests/phpunit/tests/comment-submission.php

    r35244 r35435  
    177177        $this->assertSame( $user->user_email, $comment->comment_author_email );
    178178        $this->assertSame( $user->user_url, $comment->comment_author_url );
     179        $this->assertSame( $user->ID, intval( $comment->user_id ) );
    179180
    180181    }
     
    199200        $this->assertSame( 'comment@example.org', $comment->comment_author_email );
    200201        $this->assertSame( 'http://user.example.org', $comment->comment_author_url );
     202        $this->assertSame( '0', $comment->user_id );
    201203
    202204    }
Note: See TracChangeset for help on using the changeset viewer.