Changeset 5867 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-support-reps.php
- Timestamp:
- 09/03/2017 09:43:53 PM (7 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-support-reps.php
r5864 r5867 10 10 * @package WordPressdotorg\Plugin_Directory\Admin\List_Table 11 11 */ 12 class Committers extends \WP_List_Table {12 class Support_Reps extends \WP_List_Table { 13 13 14 14 /** … … 21 21 public function __construct( $args = array() ) { 22 22 parent::__construct( array( 23 'singular' => ' committer',24 'plural' => ' committers',25 'screen' => isset( $args['screen'] ) ? $args['screen'] : null,23 'singular' => 'support_rep', 24 'plural' => 'support_reps', 25 'screen' => isset( $args['screen'] ) ? $args['screen'] : 'plugin', 26 26 ) ); 27 27 } … … 33 33 */ 34 34 public function ajax_user_can() { 35 return current_user_can( 'plugin_remove_ committer' );35 return current_user_can( 'plugin_remove_support_rep' ); 36 36 } 37 37 … … 49 49 return; 50 50 } 51 $existing_ committers = Tools::get_plugin_committers( $plugin_slug );52 $this->items = array_map( function ( $user ) {51 $existing_support_reps = Tools::get_plugin_support_reps( $plugin_slug ); 52 $this->items = array_map( function ( $user ) { 53 53 return new \WP_User( $user ); 54 }, $existing_ committers );54 }, $existing_support_reps ); 55 55 } 56 56 … … 61 61 */ 62 62 public function no_items() { 63 _e( 'No committers found.', 'wporg-plugins' );63 _e( 'No support reps found.', 'wporg-plugins' ); 64 64 } 65 65 … … 102 102 <col /> 103 103 </colgroup> 104 <tbody id="the- committer-list" data-wp-lists="list:committer">104 <tbody id="the-support-rep-list" data-wp-lists="list:support-rep"> 105 105 <?php $this->display_rows_or_placeholder(); ?> 106 106 </tbody> … … 119 119 } 120 120 ?> 121 <tr id="add- committer" class="add-committerwp-hidden-children">121 <tr id="add-support-rep" class="add-support-rep wp-hidden-children"> 122 122 <td colspan="2"> 123 <button type="button" id="add- committer-toggle" class="button-link"><?php _e( '+ Add New Committer', 'wporg-plugins' ); ?></button>123 <button type="button" id="add-support-rep-toggle" class="button-link"><?php _e( '+ Add New Support Rep', 'wporg-plugins' ); ?></button> 124 124 <p class="wp-hidden-child"> 125 <?php wp_nonce_field( 'add- committer', '_ajax_nonce', false ); ?>126 <span id=" committer-error" class="notice notice-alt notice-error" style="display:none;"></span>125 <?php wp_nonce_field( 'add-support-rep', '_ajax_nonce', false ); ?> 126 <span id="support-rep-error" class="notice notice-alt notice-error" style="display:none;"></span> 127 127 <label> 128 <input type="text" name="add_ committer" class="form-required" value="" aria-required="true" placeholder="<?php esc_attr_e( 'WordPress.org username', 'wporg-plugins' ); ?>">129 <span class="screen-reader-text"><?php _e( 'Add a new committer', 'wporg-plugins' ); ?></span>128 <input type="text" name="add_support_rep" class="form-required" value="" aria-required="true" placeholder="<?php esc_attr_e( 'WordPress.org username', 'wporg-plugins' ); ?>"> 129 <span class="screen-reader-text"><?php _e( 'Add a new support rep', 'wporg-plugins' ); ?></span> 130 130 </label> 131 <input type="button" id="add- committer-submit" class="button" data-wp-lists="add:the-committer-list:add-committer::post_id=<?php echo get_post()->ID; ?>" value="<?php _e( 'Add Committer', 'wporg-plugins' ); ?>">131 <input type="button" id="add-support-rep-submit" class="button" data-wp-lists="add:the-support-rep-list:add-support-rep::post_id=<?php echo get_post()->ID; ?>" value="<?php _e( 'Add Support Rep', 'wporg-plugins' ); ?>"> 132 132 </p> 133 133 </td> … … 151 151 list( $columns, $hidden, $primary ) = $this->get_column_info(); 152 152 153 // Set up the hover actions for this committer.153 // Set up the hover actions for this support rep. 154 154 $actions = array(); 155 155 156 // Check if the committerfor this row is removable.156 // Check if the support rep for this row is removable. 157 157 $post_id = get_post()->ID; 158 if ( current_user_can( 'plugin_remove_ committer', $post_id ) && $user_object->ID != get_current_user_id() ) {159 $actions['delete'] = "<a class='submitremove' data-wp-lists='delete:the- committer-list:committer-{$user_object->ID}:faafaa:post_id={$post_id}' href='" . wp_nonce_url( 'users.php?action=remove&committer=' . $user_object->ID, "remove-committer-{$user_object->ID}" ) . "'>" . __( 'Remove', 'wporg-plugins' ) . "</a>";158 if ( current_user_can( 'plugin_remove_support_rep', $post_id ) && $user_object->ID != get_current_user_id() ) { 159 $actions['delete'] = "<a class='submitremove' data-wp-lists='delete:the-support-rep-list:support-rep-{$user_object->ID}:faafaa:post_id={$post_id}' href='" . wp_nonce_url( 'users.php?action=remove&support-rep=' . $user_object->ID, "remove-support-rep-{$user_object->ID}" ) . "'>" . __( 'Remove', 'wporg-plugins' ) . "</a>"; 160 160 } 161 161 162 162 /** 163 * Filter the action links displayed under each committer in the Committers list table.163 * Filter the action links displayed under each support rep in the Support Reps list table. 164 164 * 165 165 * @param array $actions An array of action links to be displayed. 166 * @param \WP_User $user_object WP_User object for the currently-listed committer.166 * @param \WP_User $user_object WP_User object for the currently-listed support rep. 167 167 */ 168 $actions = apply_filters( ' committer_row_actions', $actions, $user_object );169 170 $row = "<tr id=' committer-$user_object->ID'>";168 $actions = apply_filters( 'support_rep_row_actions', $actions, $user_object ); 169 170 $row = "<tr id='support-rep-$user_object->ID'>"; 171 171 172 172 foreach ( $columns as $column_name => $column_display_name ) { … … 203 203 * @param int $user_id ID of the currently-listed user. 204 204 */ 205 $row .= apply_filters( 'manage_ committers_custom_column', '', $column_name, $user_object->ID );205 $row .= apply_filters( 'manage_support_reps_custom_column', '', $column_name, $user_object->ID ); 206 206 } 207 207 if ( $primary === $column_name ) {
Note: See TracChangeset
for help on using the changeset viewer.