Changeset 13216 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/admin/class-user-registrations-list-table.php
- Timestamp:
- 02/16/2024 04:46:29 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/admin/class-user-registrations-list-table.php
r13200 r13216 43 43 $current_view = $_REQUEST['view'] ?? $default; 44 44 45 if ( isset( $_GET['s'] ) ) {45 if ( ! empty( $_GET['s'] ) ) { 46 46 $default = 'search'; 47 47 $views[0] = [ … … 144 144 } 145 145 146 function get_columns() {146 public function get_columns() { 147 147 return [ 148 'cb' => '<input type="checkbox" />', 148 149 'user_login' => 'User Login', 149 150 'meta' => 'Meta', … … 159 160 'user_registered' => array( 'user_registered', true ), 160 161 ]; 161 } 162 } 163 164 protected function get_bulk_actions() { 165 return array( 166 'reg_block' => 'Block Reg / Ban user', 167 ); 168 } 162 169 163 170 function prepare_items() { … … 184 191 } 185 192 186 $per_page = $ this->get_items_per_page( 'users_per_page', 100 );193 $per_page = $_GET['per_page'] ?? $this->get_items_per_page( 'users_per_page', 100 ); 187 194 $current_page = $this->get_pagenum(); 188 195 … … 215 222 ]); 216 223 224 } 225 226 protected function bulk_actions( $which = '' ) { 227 parent::bulk_actions( $which ); 228 229 if ( 'top' !== $which ) { 230 return; 231 } 232 ?> 233 234 <fieldset class="alignleft actions"> 235 <input name="block_reason" id="block_reason" placeholder="Ban/Block reason. Used for bulk + single." style="width: 32em;padding: 0.4em;margin: 0;" value="<?php echo esc_attr( $_REQUEST['block_reason'] ?? '' ); ?>" /> 236 </fieldset> 237 <?php 217 238 } 218 239 … … 249 270 } 250 271 272 public function column_cb( $item ) { 273 return sprintf( 274 '<input type="checkbox" name="pending_ids[]" value="%1$s" />', 275 esc_attr( $item->pending_id ), 276 ); 277 } 278 251 279 function column_default( $item, $column_name ) { 252 280 echo esc_html( $item->$column_name ); … … 348 376 echo '<div>'; 349 377 350 echo implode( ', ',351 array_map(352 function( $ip) {353 return $this->link_to_search( $ip ) .354 ( is_callable( 'WordPressdotorg\GeoIP\query' ) ?355 ' ' . \WordPressdotorg\GeoIP\query( $ip, 'country_short' ) : '' );356 }, 357 array_filter( array_unique( [358 $meta->registration_ip ?? false, 359 $meta->confirmed_ip ?? false360 ] ) )361 ) 362 );378 $ips = []; 379 foreach ( [ 'registration', 'confirmed' ] as $field ) { 380 if ( empty( $meta->{$field . '_ip'} ) ) { 381 continue; 382 } 383 $ip = $meta->{$field . '_ip'}; 384 385 $meta->{$field . '_ip_country'} ??= ( is_callable( 'WordPressdotorg\GeoIP\query' ) ? ' ' . \WordPressdotorg\GeoIP\query( $ip, 'country_short' ) : '' ); 386 387 $ips[] = $ip . ' ' . $meta->{$field . '_ip_country'}; 388 } 389 390 echo implode( ', ', array_map( array( $this, 'link_to_Search' ), array_unique( $ips ) ) ); 363 391 364 392 echo '<hr>'; … … 446 474 447 475 return implode( '', array_map( function( $s ) { 448 if ( strlen( $s ) >= 3 ) {476 if ( strlen( $s ) >= 3 || preg_match( '/^[A-Z]{2}$/', $s ) /* country */ ) { 449 477 return '<a href="' . add_query_arg( 's', urlencode( $s ), admin_url( 'admin.php?page=user-registrations' ) ) . '">' . esc_html( $s ) . '</a>'; 450 478 }
Note: See TracChangeset
for help on using the changeset viewer.