WordPress.org

Make WordPress Core

Ticket #4529: delete-comment.10.diff

File delete-comment.10.diff, 25.0 KB (added by caesarsgrunt, 9 years ago)

slight change to enable an option for the length of time deleted comments should be kept to be added in the future

  • wp-includes/comment.php

     
    208208                $approved = "comment_approved = '1'";
    209209        elseif ( 'spam' == $status )
    210210                $approved = "comment_approved = 'spam'";
     211        elseif ( 'deleted' == $status )
     212                $approved = "comment_approved = 'deleted'";
    211213        else
    212214                $approved = "( comment_approved = '0' OR comment_approved = '1' )";
    213215
     
    699701        $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
    700702
    701703        $total = 0;
    702         $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
     704        $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'deleted' => 'deleted');
    703705        $known_types = array_keys( $approved );
    704706        foreach( (array) $count as $row_num => $row ) {
    705707                $total += $row['num_comments'];
     
    735737 * @return bool False if delete comment query failure, true on success.
    736738 */
    737739function wp_delete_comment($comment_id) {
     740        if (wp_get_comment_status($comment_id) != 'deleted' && wp_get_comment_status($comment_id) != 'spam')
     741                return wp_set_comment_status($comment_id, 'delete');
     742       
    738743        global $wpdb;
    739744        do_action('delete_comment', $comment_id);
     745       
     746        wp_unschedule_comment_destruction($comment_id);
    740747
    741748        $comment = get_comment($comment_id);
    742749
     
    784791                return 'unapproved';
    785792        elseif ( $approved == 'spam' )
    786793                return 'spam';
     794        elseif ( $approved == 'deleted' )
     795                return 'deleted';
    787796        else
    788797                return false;
    789798}
     
    10281037 */
    10291038function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) {
    10301039        global $wpdb;
    1031 
     1040        wp_unschedule_comment_destruction($comment_id);
     1041       
    10321042        $status = '0';
    10331043        switch ( $comment_status ) {
    10341044                case 'hold':
     
    10451055                        $status = 'spam';
    10461056                        break;
    10471057                case 'delete':
    1048                         return wp_delete_comment($comment_id);
     1058                        if (wp_get_comment_status($comment_id) == 'deleted' || wp_get_comment_status($comment_id) == 'spam')
     1059                                return wp_delete_comment($comment_id);
     1060                        $status = 'deleted';
     1061                        wp_schedule_comment_destruction($comment_id);
    10491062                        break;
    10501063                default:
    10511064                        return false;
     
    10711084}
    10721085
    10731086/**
     1087 * Schedules a comment for destruction in 30 days.
     1088 *
     1089 * @since 2.9.0
     1090 *
     1091 * @param int $comment_id Comment ID.
     1092 * @return void
     1093 */
     1094function wp_schedule_comment_destruction($comment_id) {
     1095        $to_destroy = get_option('to_destroy');
     1096        if (!is_array($to_destroy))
     1097                $to_destroy = array();
     1098       
     1099        $to_destroy['comments'][$comment_id] = time();
     1100       
     1101        update_option('to_destroy', $to_destroy);
     1102}
     1103
     1104/**
     1105 * Unschedules a comment for destruction.
     1106 *
     1107 * @since 2.9.0
     1108 *
     1109 * @param int $comment_id Comment ID.
     1110 * @return void
     1111 */
     1112function wp_unschedule_comment_destruction($comment_id) {
     1113        $to_destroy = get_option('to_destroy');
     1114        if (!is_array($to_destroy))
     1115                return;
     1116       
     1117        unset($to_destroy['comments'][$comment_id]);
     1118       
     1119        update_option('to_destroy', $to_destroy);
     1120}
     1121
     1122/**
    10741123 * Updates an existing comment in the database.
    10751124 *
    10761125 * Filters the comment and makes sure certain fields are valid before updating.
  • wp-includes/pluggable.php

     
    17671767}
    17681768endif;
    17691769
     1770/**
     1771 * Destroys comments which have previously been scheduled for destruction.
     1772 * Will do the same for posts, pages, etc in the future.
     1773 *
     1774 * @access private
     1775 * @since 2.9.0
     1776 *
     1777 * @return void
     1778 */
     1779function _scheduled_destruction() {
     1780        $to_destroy = get_option('to_destroy');
     1781        if (!is_array($to_destroy))
     1782                return;
     1783       
     1784        $deletetimestamp = time()-(60*60*24*30);
     1785        foreach ($to_destroy['comments'] as $comment_id => $timestamp) {
     1786                if ($timestamp < $deletetimestamp) {
     1787                        wp_delete_comment($comment_id);
     1788                        unset($to_destroy['comments'][$comment_id]);
     1789                }
     1790        }
     1791       
     1792        update_option('to_destroy', $to_destroy);
     1793}
     1794add_action( '_scheduled_destruction', '_scheduled_destruction' );
     1795if ( !wp_next_scheduled('_scheduled_destruction') && !defined('WP_INSTALLING') )
     1796        wp_schedule_event(time(), 'daily', '_scheduled_destruction');
     1797
    17701798?>
  • wp-includes/script-loader.php

     
    6363        $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090623' );
    6464        $scripts->add_data( 'common', 'group', 1 );
    6565        $scripts->localize( 'common', 'commonL10n', array(
    66                 'warnDelete' => __("You are about to delete the selected items.\n  'Cancel' to stop, 'OK' to delete."),
     66                'warnDelete' => __("You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete."),
    6767                'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};'
    6868        ) );
    6969
  • wp-admin/edit-comments.php

     
    1414
    1515$post_id = isset($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
    1616
    17 if ( ( isset( $_REQUEST['delete_all_spam'] ) || isset( $_REQUEST['delete_all_spam2'] ) ) && !empty( $_REQUEST['pagegen_timestamp'] ) ) {
    18         check_admin_referer('bulk-spam-delete', '_spam_nonce');
    19 
    20         $delete_time = $wpdb->escape( $_REQUEST['pagegen_timestamp'] );
    21         if ( current_user_can('moderate_comments')) {
    22                 $deleted_spam = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" );
    23         } else {
    24                 $deleted_spam = 0;
    25         }
    26         $redirect_to = 'edit-comments.php?comment_status=spam&deleted=' . (int) $deleted_spam;
    27         if ( $post_id )
    28                 $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
    29         wp_redirect( $redirect_to );
    30 } elseif ( isset($_REQUEST['delete_comments']) && isset($_REQUEST['action']) && ( -1 != $_REQUEST['action'] || -1 != $_REQUEST['action2'] ) ) {
     17if ( isset($_REQUEST['doaction']) ||  isset($_REQUEST['doaction2']) || isset($_REQUEST['destroy_all']) || isset($_REQUEST['destroy_all2']) ) {
    3118        check_admin_referer('bulk-comments');
    32         $doaction = ( -1 != $_REQUEST['action'] ) ? $_REQUEST['action'] : $_REQUEST['action2'];
    33 
    34         $deleted = $approved = $unapproved = $spammed = 0;
    35         foreach ( (array) $_REQUEST['delete_comments'] as $comment_id) : // Check the permissions on each
    36                 $comment_id = (int) $comment_id;
     19       
     20        if ((isset($_REQUEST['destroy_all']) || isset($_REQUEST['destroy_all2'])) && !empty($_REQUEST['pagegen_timestamp'])) {
     21                $comment_status = $wpdb->escape($_REQUEST['comment_status']);
     22                $delete_time = $wpdb->escape($_REQUEST['pagegen_timestamp']);
     23                $comment_ids = $wpdb->get_col( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = '$comment_status' AND '$delete_time' > comment_date_gmt" );
     24                $doaction = 'destroy';
     25        } elseif (($_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1) && isset($_REQUEST['delete_comments'])) {
     26                $comment_ids = $_REQUEST['delete_comments'];
     27                $doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2'];
     28        } else wp_redirect($_SERVER['HTTP_REFERER']);
     29       
     30        $approved = $unapproved = $spammed = $deleted = $destroyed = 0;
     31       
     32        foreach ($comment_ids as $comment_id) { // Check the permissions on each
    3733                $_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) );
    3834
    3935                if ( !current_user_can('edit_post', $_post_id) )
    4036                        continue;
    4137
    4238                switch( $doaction ) {
     39                        case 'approve' :
     40                                wp_set_comment_status($comment_id, 'approve');
     41                                $approved++;
     42                                break;
     43                        case 'unapprove' :
     44                                wp_set_comment_status($comment_id, 'hold');
     45                                $unapproved++;
     46                                break;
    4347                        case 'markspam' :
    4448                                wp_set_comment_status($comment_id, 'spam');
    4549                                $spammed++;
     
    4852                                wp_set_comment_status($comment_id, 'delete');
    4953                                $deleted++;
    5054                                break;
    51                         case 'approve' :
    52                                 wp_set_comment_status($comment_id, 'approve');
    53                                 $approved++;
     55                        case 'destroy' :
     56                                wp_set_comment_status($comment_id, 'delete');
     57                                $destroyed++;
    5458                                break;
    55                         case 'unapprove' :
    56                                 wp_set_comment_status($comment_id, 'hold');
    57                                 $unapproved++;
    58                                 break;
    5959                }
    60         endforeach;
     60        }
    6161
    62         $redirect_to = 'edit-comments.php?deleted=' . $deleted . '&approved=' . $approved . '&spam=' . $spammed . '&unapproved=' . $unapproved;
     62        $redirect_to = 'edit-comments.php?approved=' . $approved . '&unapproved=' . $unapproved . '&spam=' . $spammed . '&deleted=' . $deleted . '&destroyed=' . $destroyed;
    6363        if ( $post_id )
    6464                $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
    6565        if ( isset($_REQUEST['apage']) )
     
    8686$mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : esc_attr($_GET['mode']);
    8787
    8888$comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all';
    89 if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam')) )
     89if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam', 'deleted')) )
    9090        $comment_status = 'all';
    9191
    9292$comment_type = !empty($_GET['comment_type']) ? esc_attr($_GET['comment_type']) : '';
     
    102102</h2>
    103103
    104104<?php
    105 if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['spam'] ) ) {
     105if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['destroyed'] ) || isset( $_GET['spam'] ) ) {
    106106        $approved = isset( $_GET['approved'] ) ? (int) $_GET['approved'] : 0;
    107107        $deleted = isset( $_GET['deleted'] ) ? (int) $_GET['deleted'] : 0;
     108        $destroyed = isset( $_GET['destroyed'] ) ? (int) $_GET['destroyed'] : 0;
    108109        $spam = isset( $_GET['spam'] ) ? (int) $_GET['spam'] : 0;
    109110
    110         if ( $approved > 0 || $deleted > 0 || $spam > 0 ) {
     111        if ( $approved > 0 || $deleted > 0 || $destroyed > 0 || $spam > 0 ) {
    111112                echo '<div id="moderated" class="updated fade"><p>';
    112113
    113114                if ( $approved > 0 ) {
    114115                        printf( _n( '%s comment approved', '%s comments approved', $approved ), $approved );
    115116                        echo '<br />';
    116117                }
    117 
     118                if ( $spam > 0 ) {
     119                        printf( _n( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam );
     120                        echo '<br />';
     121                }
    118122                if ( $deleted > 0 ) {
    119123                        printf( _n( '%s comment deleted', '%s comments deleted', $deleted ), $deleted );
    120124                        echo '<br />';
    121125                }
    122 
    123                 if ( $spam > 0 ) {
    124                         printf( _n( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam );
     126                if ( $destroyed > 0 ) {
     127                        printf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $destroyed ), $destroyed );
    125128                        echo '<br />';
    126129                }
    127130
     
    139142//, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
    140143$stati = array(
    141144                'all' => _n_noop('All', 'All'), // singular not used
    142                 'moderated' => _n_noop('Pending (<span class="pending-count">%s</span>)', 'Pending (<span class="pending-count">%s</span>)'),
     145                'moderated' => _n_noop('Pending <span class="count">(<span class="pending-count">%s</span>)</span>', 'Pending <span class="count">(<span class="pending-count">%s</span>)</span>'),
    143146                'approved' => _n_noop('Approved', 'Approved'), // singular not used
    144                 'spam' => _n_noop('Spam (<span class="spam-count">%s</span>)', 'Spam (<span class="spam-count">%s</span>)')
     147                'spam' => _n_noop('Spam <span class="count">(<span class="spam-count">%s</span>)</span>', 'Spam <span class="count">(<span class="spam-count">%s</span>)</span>'),
     148                'deleted' => _n_noop('Deleted <span class="count">(<span class="deleted-count">%s</span>)</span>', 'Deleted <span class="count">(<span class="deleted-count">%s</span>)</span>')
    145149        );
    146150$link = 'edit-comments.php';
    147151if ( !empty($comment_type) && 'all' != $comment_type )
     
    246250<?php if ( 'all' == $comment_status || 'approved' == $comment_status ): ?>
    247251<option value="unapprove"><?php _e('Unapprove'); ?></option>
    248252<?php endif; ?>
    249 <?php if ( 'all' == $comment_status || 'moderated' == $comment_status || 'spam' == $comment_status ): ?>
     253<?php if ( 'approved' != $comment_status ): ?>
    250254<option value="approve"><?php _e('Approve'); ?></option>
    251255<?php endif; ?>
    252256<?php if ( 'spam' != $comment_status ): ?>
    253257<option value="markspam"><?php _e('Mark as Spam'); ?></option>
    254258<?php endif; ?>
     259<?php if ( 'deleted' == $comment_status || 'spam' == $comment_status ): ?>
     260<option value="destroy"><?php _e('Delete Permanently'); ?></option>
     261<?php else: ?>
    255262<option value="delete"><?php _e('Delete'); ?></option>
     263<?php endif; ?>
    256264</select>
    257265<input type="submit" name="doaction" id="doaction" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary apply" />
    258266<?php wp_nonce_field('bulk-comments'); ?>
     
    278286        <input type="hidden" name="apage" value="<?php echo esc_attr( absint( $_GET['apage'] ) ); ?>" />
    279287<?php }
    280288
    281 if ( 'spam' == $comment_status ) {
    282         wp_nonce_field('bulk-spam-delete', '_spam_nonce');
     289if ( 'spam' == $comment_status || 'deleted' == $comment_status ) {
     290        wp_nonce_field('bulk-destroy', '_destroy_nonce');
    283291        if ( current_user_can ('moderate_comments')) { ?>
    284                 <input type="submit" name="delete_all_spam" value="<?php esc_attr_e('Delete All Spam'); ?>" class="button-secondary apply" />
    285 <?php   }
     292                <input type="submit" name="destroy_all" id="destroy_all" value="<?php esc_attr_e('Permanently Delete All'); ?>" class="button-secondary apply" />
     293<?php }
    286294} ?>
    287295<?php do_action('manage_comments_nav', $comment_status); ?>
    288296</div>
     
    333341<?php if ( 'all' == $comment_status || 'approved' == $comment_status ): ?>
    334342<option value="unapprove"><?php _e('Unapprove'); ?></option>
    335343<?php endif; ?>
    336 <?php if ( 'all' == $comment_status || 'moderated' == $comment_status || 'spam' == $comment_status ): ?>
     344<?php if ( 'approved' != $comment_status ): ?>
    337345<option value="approve"><?php _e('Approve'); ?></option>
    338346<?php endif; ?>
    339347<?php if ( 'spam' != $comment_status ): ?>
    340348<option value="markspam"><?php _e('Mark as Spam'); ?></option>
    341349<?php endif; ?>
     350<?php if ( 'deleted' == $comment_status || 'spam' == $comment_status ): ?>
     351<option value="destroy"><?php _e('Delete Permanently'); ?></option>
     352<?php else: ?>
    342353<option value="delete"><?php _e('Delete'); ?></option>
     354<?php endif; ?>
    343355</select>
    344356<input type="submit" name="doaction2" id="doaction2" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary apply" />
    345357
    346 <?php if ( 'spam' == $comment_status ) { ?>
    347 <input type="submit" name="delete_all_spam2" value="<?php esc_attr_e('Delete All Spam'); ?>" class="button-secondary apply" />
     358<?php if ( 'spam' == $comment_status || 'deleted' == $comment_status ) { ?>
     359<input type="submit" name="destroy_all2" id="destroy_all2" value="<?php esc_attr_e('Permanently Delete All'); ?>" class="button-secondary apply" />
    348360<?php } ?>
    349361<?php do_action('manage_comments_nav', $comment_status); ?>
    350362</div>
  • wp-admin/admin-ajax.php

     
    192192                        die( (string) time() );
    193193                $r = wp_set_comment_status( $comment->comment_ID, 'spam' );
    194194        } else {
    195                 $r = wp_delete_comment( $comment->comment_ID );
     195                $r = wp_set_comment_status( $comment->comment_ID, 'delete' );
    196196        }
    197197        if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts
    198198                _wp_ajax_delete_comment_response( $comment->comment_ID );
     
    336336                die( (string) time() );
    337337
    338338        $r = 0;
    339         if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) {
     339        if ( in_array( $current, array( 'unapproved', 'spam', 'deleted' ) ) ) {
    340340                check_ajax_referer( "approve-comment_$id" );
    341341                $result = wp_set_comment_status( $comment->comment_ID, 'approve', true );
    342342        } else {
  • wp-admin/wp-admin.css

     
    444444        display: none;
    445445}
    446446
    447 .unapproved .approve, .spam .approve {
     447.unapproved .approve, .spam .approve, .deleted .approve {
    448448        display: inline;
    449449}
    450450
  • wp-admin/includes/template.php

     
    20092009        } elseif ( 'spam' == $status ) {
    20102010                $approved = "comment_approved = 'spam'";
    20112011                $total = $count->spam;
     2012        } elseif ( 'deleted' == $status ) {
     2013                $approved = "comment_approved = 'deleted'";
     2014                $total = $count->deleted;
    20122015        } else {
    20132016                $approved = "( comment_approved = '0' OR comment_approved = '1' )";
    20142017                $total = $count->moderated + $count->approved;
     
    21482151                                        }
    21492152                                        if ( 'spam' != $the_comment_status )
    21502153                                                $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' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
    2151                                         $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
     2154                                        if ( 'deleted' == $the_comment_status || 'spam' == $the_comment_status )
     2155                                                $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::deleted=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
     2156                                        else
     2157                                                $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
    21522158                                        $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
    21532159                                        $actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick&nbsp;Edit') . '</a>';
    2154                                         if ( 'spam' != $the_comment_status )
     2160                                        if ( 'spam' != $the_comment_status && 'deleted' != $the_comment_status )
    21552161                                                $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\');return false;" class="vim-r" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
    21562162
    21572163                                        $actions = apply_filters( 'comment_row_actions', $actions, $comment );
  • wp-admin/js/common.dev.js

     
    156156
    157157        // show warnings
    158158        $('#doaction, #doaction2').click(function(){
    159                 if ( $('select[name="action"]').val() == 'delete' || $('select[name="action2"]').val() == 'delete' ) {
     159                if ( $('select[name="action"]').val() == 'destroy' || $('select[name="action2"]').val() == 'destroy' ) {
    160160                        return showNotice.warn();
    161161                }
    162162        });
     163        $('#destroy_all, #destroy_all2').click(function(){
     164                return showNotice.warn();
     165        });
    163166
    164167        // screen settings tab
    165168        $('#show-settings-link').click(function () {
  • wp-admin/js/edit-comments.dev.js

     
    3838                settings.data._page = pageInput.val();
    3939                settings.data._url = document.location.href;
    4040
    41                 if ( 'undefined' != showNotice && settings.data.action && settings.data.action == 'delete-comment' && !settings.data.spam )
     41                if ( 'undefined' != showNotice && settings.data.action && settings.data.action == 'delete-comment' && settings.data.deleted)
    4242                        return showNotice.warn() ? settings : false;
    4343
    4444                return settings;
     
    9191                        if ( isNaN(n) ) return;
    9292                        if ( $(settings.target).parents( 'span.spam' ).size() ) { // we marked a comment as spam
    9393                                n = n + 1;
    94                         } else if ( $('#' + settings.element).is('.spam') ) { // we approved or deleted a comment marked as spam
     94                        } else if ( $('#' + settings.element).is('.spam') ) { // we approved, deleted, or destroyed a comment marked as spam
    9595                                n = n - 1;
    9696                        }
    9797                        if ( n < 0 ) { n = 0; }
     
    101101                        a.html(n);
    102102                });
    103103
     104                $('span.deleted-count').each( function() {
     105                        var a = $(this), n;
     106                        n = a.html().replace(/[ ,.]+/g, '');
     107                        n = parseInt(n,10);
     108                        if ( isNaN(n) ) return;
     109                        if ( $(settings.target).parents( 'span.delete' ).size() && $('#' + settings.element).is('.deleted,.spam') ) { // we destroyed a deleted or spam comment
     110                                n--;
     111                        } else if ( $(settings.target).parents( 'span.delete' ).size() ) { // we deleted a comment
     112                                n++;
     113                        } else if ( $('#' + settings.element).is('.deleted') ) { // we approved or spammed a deleted comment
     114                                n--;
     115                        }
     116                        if ( n < 0 ) { n = 0; }
     117                        n = n.toString();
     118                        if ( n.length > 3 )
     119                                n = n.substr(0, n.length-3)+' '+n.substr(-3);
     120                        a.html(n);
     121                });
    104122
     123
    105124                // XML response
    106125                if ( ( 'object' == typeof r ) && lastConfidentTime < settings.parsed.responses[0].supplemental.time ) {
    107126                        // Set the total to the known good value (even if this value is a little old, newer values should only be a few less, and so shouldn't mess up the page links)
  • wp-admin/edit-form-comment.php

     
    3838<div class="submitbox" id="submitcomment">
    3939<div id="minor-publishing">
    4040
     41<?php if ($comment->comment_approved == '1') { ?>
    4142<div id="minor-publishing-actions">
    4243<div id="preview-action">
    4344<a class="preview button" href="<?php echo get_comment_link(); ?>" target="_blank"><?php _e('View Comment'); ?></a>
    4445</div>
    4546<div class="clear"></div>
    4647</div>
     48<?php } ?>
    4749
    4850<div id="misc-publishing-actions">
    4951
    5052<div class="misc-pub-section" id="comment-status-radio">
    5153<label class="approved"><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php /* translators: comment type radio button */ echo _x('Approved', 'adjective') ?></label><br />
    5254<label class="waiting"><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php /* translators: comment type radio button */ echo _x('Pending', 'adjective') ?></label><br />
    53 <label class="spam"><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php /* translators: comment type radio button */ echo _x('Spam', 'adjective'); ?></label>
     55<label class="spam"><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php /* translators: comment type radio button */ echo _x('Spam', 'adjective'); ?></label><br />
     56<?php if ($comment->comment_approved == 'deleted') { ?>
     57<label class="deleted"><input type="radio"<?php checked( $comment->comment_approved, 'deleted' ); ?> name="comment_status" value="deleted" /><?php /* translators: comment type radio button */ echo _x('Deleted', 'adjective'); ?></label>
     58<?php } ?>
    5459</div>
    5560
    5661<div class="misc-pub-section curtime misc-pub-section-last">
     
    6974
    7075<div id="major-publishing-actions">
    7176<div id="delete-action">
    72 <?php echo "<a class='submitdelete deletion' href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . urlencode(wp_get_referer()), 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . esc_js(__("You are about to delete this comment. \n  'Cancel' to stop, 'OK' to delete.")) . "') ){return true;}return false;\">" . __('Delete') . "</a>\n"; ?>
     77<?php
     78if ($comment->comment_approved == 'deleted')
     79        echo "<a class='submitdelete deletion' href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . urlencode(wp_get_referer()), 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . esc_js(__("You are about to delete this comment. \n  'Cancel' to stop, 'OK' to delete.")) . "') ){return true;}return false;\">" . __('Delete Permanently') . "</a>\n";
     80else
     81        echo "<a class='submitdelete deletion' href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . urlencode(wp_get_referer()), 'delete-comment_' . $comment->comment_ID) . "'>" . __('Delete') . "</a>\n";
     82?>
    7383</div>
    7484<div id="publishing-action">
    7585<input type="submit" name="save" value="<?php esc_attr_e('Update Comment'); ?>" tabindex="4" class="button-primary" />
  • wp-admin/css/colors-fresh.css

     
    5858        border-color: #ccc;
    5959}
    6060
    61 #poststuff .inside label.spam {
     61#poststuff .inside label.spam,
     62#poststuff .inside label.deleted {
    6263        color: red;
    6364}
    6465
  • wp-admin/css/colors-classic.css

     
    5858        border-color: #ccc;
    5959}
    6060
    61 #poststuff .inside label.spam {
     61#poststuff .inside label.spam,
     62#poststuff .inside label.deleted {
    6263        color: red;
    6364}
    6465