Making WordPress.org

Changeset 12269


Ignore:
Timestamp:
11/23/2022 04:16:19 AM (4 years ago)
Author:
dd32
Message:

Make: Trac Props editor: Restrict props editing to those who can publish posts.

Props peterwilsoncc, dd32.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/list-table.php

    r11371 r12269  
    342342
    343343                        case 'props':
    344                                 $output = '<div class="propslist">';
     344                                $can_edit = current_user_can( 'publish_posts' );
     345                                $output   = '<div class="propslist">';
    345346
    346347                                foreach ( $item->props as $prop => $user_id ) {
     
    373374                                                $output .= '</a>';
    374375                                        }
    375                                         $output .= '<div class="overlay"><div class="actions"><a href="#" class="edit dashicons dashicons-edit"></a></div></div>';
     376                                        if ( $can_edit ) {
     377                                                $output .= '<div class="overlay"><div class="actions"><a href="#" class="edit dashicons dashicons-edit"></a></div></div>';
     378                                        }
    376379
    377380                                        if ( $prop_is_different_from_user || $prop_display_name_different ) {
     
    385388                                        $output .= '</span>';
    386389                                }
    387                                 $output .= '<span class="user add"><a href="#" class="add dashicons dashicons-plus"></a>&nbsp;<a href="#" class="add">Add new</a></span>';
     390
     391                                if ( $can_edit ) {
     392                                        $output .= '<span class="user add"><a href="#" class="add dashicons dashicons-plus"></a>&nbsp;<a href="#" class="add">Add new</a></span>';
     393                                }
     394
    388395                                $output .= '</div>';
    389396
    390                                 $output .= '<p class="actions"><a href="#" class="reparse">Reparse</a></p>';
     397                                if ( $can_edit ) {
     398                                        $output .= '<p class="actions"><a href="#" class="reparse">Reparse</a></p>';
     399                                }
    391400
    392401                                return $output;
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/post.php

    r11370 r12269  
    55        global $wpdb;
    66
    7         if ( ! current_user_can( 'edit_posts' ) ) {
     7        if ( ! current_user_can( 'publish_posts' ) ) {
    88                die( '-1' );
    99        }
     
    133133        global $wpdb;
    134134
    135         if ( ! current_user_can( 'edit_posts' ) ) {
     135        if ( ! current_user_can( 'publish_posts' ) ) {
    136136                die( '-1' );
    137137        }
Note: See TracChangeset for help on using the changeset viewer.