WordPress.org

Make WordPress Core

Ticket #4529: emptytrash.patch

File emptytrash.patch, 2.4 KB (added by mrmist, 9 years ago)

Show emtpy trash button only when people can do so.

  • wp-admin/edit-comments.php

     
    302302        wp_nonce_field('bulk-destroy', '_destroy_nonce');
    303303    if ( 'spam' == $comment_status ) { ?>
    304304                <input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Spam'); ?>" class="button-secondary apply" />
    305 <?php } elseif ( 'trash' == $comment_status ) { ?>
     305<?php } elseif ( 'trash' == $comment_status && current_user_can('moderate_comments') ) { ?>
    306306                <input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
    307307<?php }
    308308} ?>
     
    374374
    375375<?php if ( 'spam' == $comment_status ) { ?>
    376376<input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Spam'); ?>" class="button-secondary apply" />
    377 <?php } elseif ( 'trash' == $comment_status ) { ?>
     377<?php } elseif ( 'trash' == $comment_status && current_user_can('moderate_comments') ) { ?>
    378378<input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
    379379<?php } ?>
    380380<?php do_action('manage_comments_nav', $comment_status); ?>
  • wp-admin/edit.php

     
    284284do_action('restrict_manage_posts');
    285285?>
    286286<input type="submit" id="post-query-submit" value="<?php esc_attr_e('Filter'); ?>" class="button-secondary" />
    287 <?php } if ( $_GET['post_status'] == 'trash' ) { ?>
     287<?php } if ( $_GET['post_status'] == 'trash' && current_user_can('edit_others_posts') ) { ?>
    288288<input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
    289289<?php } ?>
    290290</div>
     
    329329<?php } ?>
    330330</select>
    331331<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
    332 <?php if ( $_GET['post_status'] == 'trash' ) { ?>
     332<?php if ( $_GET['post_status'] == 'trash' && current_user_can('edit_others_posts') ) { ?>
    333333<input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
    334334<?php } ?>
    335335<br class="clear" />