Changeset 10681 for trunk/wp-admin/admin-ajax.php
- Timestamp:
- 03/02/2009 09:48:37 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/admin-ajax.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r10641 r10681 315 315 break; 316 316 case 'dim-comment' : // On success, die with time() instead of 1 317 if ( !$comment = get_comment( $id ) ) 318 die('0'); 317 318 if ( !$comment = get_comment( $id ) ) { 319 $x = new WP_Ajax_Response( array( 320 'what' => 'comment', 321 'id' => new WP_Error('invalid_comment', sprintf(__('Comment %d does not exist'), $id)) 322 ) ); 323 $x->send(); 324 } 319 325 320 326 if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) … … 330 336 if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) { 331 337 check_ajax_referer( "approve-comment_$id" ); 332 if ( wp_set_comment_status( $comment->comment_ID, 'approve' ) ) 333 $r = 1; 338 $result = wp_set_comment_status( $comment->comment_ID, 'approve', true ); 334 339 } else { 335 340 check_ajax_referer( "unapprove-comment_$id" ); 336 if ( wp_set_comment_status( $comment->comment_ID, 'hold' ) ) 337 $r = 1; 338 } 339 if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts 340 _wp_ajax_delete_comment_response( $comment->comment_ID ); 341 $result = wp_set_comment_status( $comment->comment_ID, 'hold', true ); 342 } 343 if ( is_wp_error($result) ) { 344 $x = new WP_Ajax_Response( array( 345 'what' => 'comment', 346 'id' => $result 347 ) ); 348 $x->send(); 349 } 350 351 // Decide if we need to send back '1' or a more complicated response including page links and comment counts 352 _wp_ajax_delete_comment_response( $comment->comment_ID ); 341 353 die( '0' ); 342 354 break;
Note: See TracChangeset
for help on using the changeset viewer.