Make WordPress Core


Ignore:
Timestamp:
03/02/2009 09:48:37 PM (16 years ago)
Author:
ryan
Message:

Add some error feedback to ajax comment moderation. see #9261

File:
1 edited

Legend:

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

    r10579 r10681  
    10151015 * @param int $comment_id Comment ID.
    10161016 * @param string $comment_status New comment status, either 'hold', 'approve', 'spam', or 'delete'.
     1017 * @param bool $wp_error Whether to return a WP_Error object if there is a failure. Default is false.
    10171018 * @return bool False on failure or deletion and true on success.
    10181019 */
    1019 function wp_set_comment_status($comment_id, $comment_status) {
     1020function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) {
    10201021    global $wpdb;
    10211022
     
    10411042    }
    10421043
    1043     if ( !$wpdb->query($query) )
    1044         return false;
     1044    if ( !$wpdb->query($query) ) {
     1045        if ( $wp_error )
     1046            return new WP_Error('db_update_error', __('Could not update comment status'), $wpdb->last_error);
     1047        else
     1048            return false;
     1049    }
    10451050
    10461051    clean_comment_cache($comment_id);
Note: See TracChangeset for help on using the changeset viewer.