WordPress.org

Make WordPress Core

Ticket #27132: dashboard.php.diff

File dashboard.php.diff, 1018 bytes (added by jackreichert, 7 years ago)

Encapsulates the future activity in capabilities condition

  • src/wp-admin/includes/dashboard.php

    diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php
    index 0f62ebc..88d6520 100644
    a b function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { 
    527527function wp_dashboard_site_activity() {
    528528
    529529        echo '<div id="activity-widget">';
    530 
    531         $future_posts = wp_dashboard_recent_posts( array(
    532                 'display' => 2,
    533                 'max'     => 5,
    534                 'status'  => 'future',
    535                 'order'   => 'ASC',
    536                 'title'   => __( 'Publishing Soon' ),
    537                 'id'      => 'future-posts',
    538         ) );
     530       
     531        // only show if user has relevant capabilities
     532        if (current_user_can('edit_posts')) {
     533                $future_posts = wp_dashboard_recent_posts( array(
     534                        'display' => 2,
     535                        'max'     => 5,
     536                        'status'  => 'future',
     537                        'order'   => 'ASC',
     538                        'title'   => __( 'Publishing Soon' ),
     539                        'id'      => 'future-posts',
     540                ) );
     541        }
     542       
    539543        $recent_posts = wp_dashboard_recent_posts( array(
    540544                'display' => 2,
    541545                'max'     => 5,