WordPress.org

Make WordPress Core

Ticket #16365: 16365v5.diff

File 16365v5.diff, 1.6 KB (added by MattyRob, 6 years ago)
  • wp-includes/comment.php

     
    19161916 * @param string $new_status New comment status.
    19171917 * @param string $old_status Previous comment status.
    19181918 * @param object $comment Comment data.
     1919 *
     1920 * @since 4.2.0
     1921 *
     1922 * Introduced a the comment status of 'new' for new comments in wp_new_comment().
     1923 * This allows comment status transitions as described above but for new comments in the
     1924 * same way as new posts.
     1925 * For example the action 'comment_new_to_approved' is now available, as is 'comment_new_',
     1926 * 'comment_new_pingback' and 'comment_new_trackback'.
    19191927 */
    19201928function wp_transition_comment_status($new_status, $old_status, $comment) {
    19211929        /*
     
    21812189 * @since 1.5.0
    21822190 * @param array $commentdata Contains information on the comment.
    21832191 * @return int|bool The ID of the comment on success, false on failure.
     2192 * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object
    21842193 */
    21852194function wp_new_comment( $commentdata ) {
    21862195        if ( isset( $commentdata['user_ID'] ) ) {
     
    22332242         * @param int $comment_approved 1 (true) if the comment is approved, 0 (false) if not.
    22342243         */
    22352244        do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'] );
     2245        wp_transition_comment_status( $commentdata['comment_approved'], 'new', (object) $commentdata );
    22362246
    22372247        if ( 'spam' !== $commentdata['comment_approved'] ) { // If it's spam save it silently for later crunching
    22382248                if ( '0' == $commentdata['comment_approved'] ) {