Ticket #4529: delete-comment.diff
| File delete-comment.diff, 7.0 KB (added by caesarsgrunt, 4 years ago) |
|---|
-
wp-admin/edit-comments.php
100 100 $stati = array( 101 101 'moderated' => sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"), 102 102 'approved' => _c('Approved|plural'), 103 'spam' => sprintf(__ngettext('Spam (%s)', 'Spam (%s)', number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>") 103 'spam' => sprintf(__ngettext('Spam (%s)', 'Spam (%s)', number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>"), 104 'deleted' => sprintf(__ngettext('Deleted (%s)', 'Deleted (%s)', number_format_i18n($num_comments->deleted) ), "<span class='deleted-comment-count'>" . number_format_i18n($num_comments->deleted) . "</span>") 104 105 ); 105 106 $class = ( '' === $comment_status ) ? ' class="current"' : ''; 106 107 $status_links[] = "<li><a href=\"edit-comments.php\"$class>".__('Show All Comments')."</a>"; … … 183 184 <?php if ( 'spam' != $comment_status ): ?> 184 185 <option value="markspam"><?php _e('Mark as Spam'); ?></option> 185 186 <?php endif; ?> 187 <?php if ( 'deleted' != $comment_status ): ?> 186 188 <option value="delete"><?php _e('Delete'); ?></option> 189 <?php else : ?> 190 <option value="delete"><?php _e('Delete Permenantly'); ?></option> 191 <?php endif; ?> 187 192 </select> 188 193 <input type="submit" name="doaction" value="Apply" class="button-secondary apply" /> 189 194 <?php do_action('manage_comments_nav', $comment_status); ?> -
wp-admin/admin-ajax.php
182 182 if ( $_POST['new'] == $current ) 183 183 die('1'); 184 184 185 if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) {185 if ( in_array( $current, array( 'unapproved', 'spam', 'deleted' ) ) ) { 186 186 check_ajax_referer( "approve-comment_$id" ); 187 187 if ( wp_set_comment_status( $comment->comment_ID, 'approve' ) ) 188 188 die('1'); -
wp-admin/wp-admin.css
249 249 display: none; 250 250 } 251 251 252 .unapproved .approve, .spam .approve {252 .unapproved .approve, .spam .approve, .deleted .approve { 253 253 display: inline; 254 254 } 255 255 -
wp-admin/includes/template.php
948 948 $approved = "comment_approved = '1'"; 949 949 elseif ( 'spam' == $status ) 950 950 $approved = "comment_approved = 'spam'"; 951 elseif ( 'deleted' == $status ) 952 $approved = "comment_approved = 'deleted'"; 951 953 else 952 954 $approved = "( comment_approved = '0' OR comment_approved = '1' )"; 953 955 … … 1021 1023 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a> | '; 1022 1024 if ( 'spam' != $the_comment_status ) 1023 1025 $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | '; 1024 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>'; 1026 if ( 'deleted' == $the_comment_status ) 1027 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>'; 1028 else 1029 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>'; 1025 1030 1026 1031 if ( $comment_status ) { // not looking at all comments 1027 1032 if ( 'approved' == $the_comment_status ) { … … 1033 1038 } 1034 1039 } 1035 1040 1036 if ( 'spam' != $the_comment_status )1041 if ( 'spam' != $the_comment_status && 'deleted' != $the_comment_status ) 1037 1042 $actions['reply'] = '<span class="hide-if-no-js"> | <a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',this);return false;" class="vim-r" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a></span>'; 1038 1043 1039 1044 $actions = apply_filters( 'comment_row_actions', $actions, $comment ); -
wp-admin/js/edit-comments.js
67 67 if ( n < 0 ) { n = 0; } 68 68 a.html( n.toString() ); 69 69 }); 70 $('li span.deleted-comment-count' ).each( function() { 71 var a = $(this); 72 var n = parseInt(a.html(),10); 73 if ( $(settings.target).parents( 'span.delete' ).size() && !$('#' + settings.element).is('.deleted') ) { // we deleted a comment 74 n = n + 1; 75 } else if ( $('#' + settings.element).is('.deleted') ) { // we approved or deleted a deleted comment 76 n = n - 1; 77 } 78 if ( n < 0 ) { n = 0; } 79 a.html( n.toString() ); 80 }); 70 81 71 82 if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) { 72 83 return; -
wp-includes/comment.php
540 540 541 541 $total = 0; 542 542 $stats = array( ); 543 $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam' );543 $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'deleted' => 'deleted'); 544 544 foreach( (array) $count as $row_num => $row ) { 545 545 $total += $row['num_comments']; 546 546 $stats[$approved[$row['comment_approved']]] = $row['num_comments']; … … 578 578 579 579 $comment = get_comment($comment_id); 580 580 581 if ( ! $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id) ) ) 582 return false; 581 if ($comment->comment_approved == 'deleted') 582 return $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id) ); 583 else 584 return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='deleted' WHERE comment_ID = %d LIMIT 1", $comment_id) ); 585 // if ( ! $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id) ) ) 586 // if ( ! $wpdb->query( $wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='deleted' WHERE comment_ID = %d LIMIT 1", $comment_id) ) ) 587 // return false; 583 588 584 589 $post_id = $comment->comment_post_ID; 585 590 if ( $post_id && $comment->comment_approved == 1 ) … … 614 619 return 'unapproved'; 615 620 elseif ( $approved == 'spam' ) 616 621 return 'spam'; 622 elseif ( $approved == 'deleted' ) 623 return 'deleted'; 617 624 else 618 625 return false; 619 626 }
