Make WordPress Core


Ignore:
Timestamp:
09/14/2015 09:39:46 PM (9 years ago)
Author:
wonderboymusic
Message:

More comment functions can accept a full object instead of comment_ID to reduce cache/db lookups.

See ##33638.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r34074 r34129  
    521521
    522522    check_ajax_referer( "delete-comment_$id" );
    523     $status = wp_get_comment_status( $comment->comment_ID );
     523    $status = wp_get_comment_status( $comment );
    524524
    525525    $delta = -1;
     
    731731        wp_die( -1 );
    732732
    733     $current = wp_get_comment_status( $comment->comment_ID );
     733    $current = wp_get_comment_status( $comment );
    734734    if ( isset( $_POST['new'] ) && $_POST['new'] == $current )
    735735        wp_die( time() );
    736736
    737737    check_ajax_referer( "approve-comment_$id" );
    738     if ( in_array( $current, array( 'unapproved', 'spam' ) ) )
    739         $result = wp_set_comment_status( $comment->comment_ID, 'approve', true );
    740     else
    741         $result = wp_set_comment_status( $comment->comment_ID, 'hold', true );
     738    if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) {
     739        $result = wp_set_comment_status( $comment, 'approve', true );
     740    } else {
     741        $result = wp_set_comment_status( $comment, 'hold', true );
     742    }
    742743
    743744    if ( is_wp_error($result) ) {
     
    10161017            }
    10171018
    1018             if ( wp_set_comment_status( $parent->comment_ID, 'approve' ) )
     1019            if ( wp_set_comment_status( $parent, 'approve' ) )
    10191020                $comment_auto_approved = true;
    10201021        }
Note: See TracChangeset for help on using the changeset viewer.