run:R W Run
7.85 KB
2026-03-11 16:18:51
R W Run
3.54 KB
2026-03-11 16:18:51
R W Run
148.33 KB
2026-03-11 16:18:51
R W Run
11.45 KB
2026-03-11 16:18:51
R W Run
3.58 KB
2026-03-11 16:18:51
R W Run
2.53 KB
2026-03-11 16:18:51
R W Run
2.6 KB
2026-03-11 16:18:51
R W Run
6.59 KB
2026-03-11 16:18:51
R W Run
14.83 KB
2026-03-11 16:18:51
R W Run
21.18 KB
2026-03-11 16:18:51
R W Run
48.13 KB
2026-03-11 16:18:51
R W Run
4.07 KB
2026-03-11 16:18:51
R W Run
5.3 KB
2026-03-11 16:18:51
R W Run
8.28 KB
2026-03-11 16:18:51
R W Run
26.73 KB
2026-03-11 16:18:51
R W Run
2.8 KB
2026-03-11 16:18:51
R W Run
15.2 KB
2026-03-11 16:18:51
R W Run
192.08 KB
2026-03-11 16:18:51
R W Run
11.77 KB
2026-03-11 16:18:51
R W Run
3.2 KB
2026-03-11 16:18:51
R W Run
22.89 KB
2026-03-11 16:18:51
R W Run
12.77 KB
2026-03-11 16:18:51
R W Run
4.08 KB
2026-03-11 16:18:51
R W Run
26.27 KB
2026-03-11 16:18:51
R W Run
4.97 KB
2026-03-11 16:18:51
R W Run
5.57 KB
2026-03-11 16:18:51
R W Run
13.93 KB
2026-03-11 16:18:51
R W Run
4.09 KB
2026-03-11 16:18:51
R W Run
6.79 KB
2026-03-11 16:18:51
R W Run
60.45 KB
2026-03-11 16:18:51
R W Run
32.4 KB
2026-03-11 16:18:51
R W Run
18.24 KB
2026-03-11 16:18:51
R W Run
66.01 KB
2026-03-11 16:18:51
R W Run
23.84 KB
2026-03-11 16:18:51
R W Run
17.72 KB
2026-03-11 16:18:51
R W Run
22.71 KB
2026-03-11 16:18:51
R W Run
18.05 KB
2026-03-11 16:18:51
R W Run
22.76 KB
2026-03-11 16:18:51
R W Run
7.34 KB
2026-03-11 16:18:51
R W Run
4.51 KB
2026-03-11 16:18:51
R W Run
9.02 KB
2026-03-11 16:18:51
R W Run
1.46 KB
2026-03-11 16:18:51
R W Run
51.76 KB
2026-03-11 16:18:51
R W Run
25.29 KB
2026-03-11 16:18:51
R W Run
21.61 KB
2026-03-11 16:18:51
R W Run
27.77 KB
2026-03-11 16:18:51
R W Run
15.35 KB
2026-03-11 16:18:51
R W Run
24.54 KB
2026-03-11 16:18:51
R W Run
56.44 KB
2026-03-11 16:18:51
R W Run
1.42 KB
2026-03-11 16:18:51
R W Run
63.66 KB
2026-03-11 16:18:51
R W Run
31.9 KB
2026-03-11 16:18:51
R W Run
14.44 KB
2026-03-11 16:18:51
R W Run
36.47 KB
2026-03-11 16:18:51
R W Run
14 KB
2026-03-11 16:18:51
R W Run
121.89 KB
2026-03-11 16:18:51
R W Run
6.26 KB
2026-03-11 16:18:51
R W Run
20.73 KB
2026-03-11 16:18:51
R W Run
15.23 KB
2026-03-11 16:18:51
R W Run
10.14 KB
2026-03-11 16:18:51
R W Run
6.94 KB
2026-03-11 16:18:51
R W Run
1.44 KB
2026-03-11 16:18:51
R W Run
46.85 KB
2026-03-11 16:18:51
R W Run
18.61 KB
2026-03-11 16:18:51
R W Run
6.08 KB
2026-03-11 16:18:51
R W Run
20.06 KB
2026-03-11 16:18:51
R W Run
5.73 KB
2026-03-11 16:18:51
R W Run
68.18 KB
2026-03-11 16:18:51
R W Run
40.8 KB
2026-03-11 16:18:51
R W Run
1.44 KB
2026-03-11 16:18:51
R W Run
25.26 KB
2026-03-11 16:18:51
R W Run
95.94 KB
2026-03-11 16:18:51
R W Run
43.12 KB
2026-03-11 16:18:51
R W Run
41.73 KB
2026-03-11 16:18:51
R W Run
6.46 KB
2026-03-11 16:18:51
R W Run
3.71 KB
2026-03-11 16:18:51
R W Run
116.31 KB
2026-03-11 16:18:51
R W Run
9.39 KB
2026-03-11 16:18:51
R W Run
64.34 KB
2026-03-11 16:18:51
R W Run
44.73 KB
2026-03-11 16:18:51
R W Run
1.27 KB
2026-03-11 16:18:51
R W Run
3.68 KB
2026-03-11 16:18:51
R W Run
33.53 KB
2026-03-11 16:18:51
R W Run
48.84 KB
2026-03-11 16:18:51
R W Run
26.35 KB
2026-03-11 16:18:51
R W Run
1.12 KB
2026-03-11 16:18:51
R W Run
4.19 KB
2026-03-11 16:18:51
R W Run
38.19 KB
2026-03-11 16:18:51
R W Run
91.33 KB
2026-03-11 16:18:51
R W Run
80.39 KB
2026-03-11 16:18:51
R W Run
32.67 KB
2026-03-11 16:18:51
R W Run
16.18 KB
2026-03-11 16:18:51
R W Run
44.46 KB
2026-03-11 16:18:51
R W Run
6.23 KB
2026-03-11 16:18:51
R W Run
8.23 KB
2026-03-11 16:18:51
R W Run
96.96 KB
2026-03-11 16:18:51
R W Run
6.83 KB
2026-03-11 16:18:51
R W Run
46.62 KB
2026-03-11 16:18:51
R W Run
10.82 KB
2026-03-11 16:18:51
R W Run
68.86 KB
2026-03-11 16:18:51
R W Run
33.63 KB
2026-03-11 16:18:51
R W Run
113.3 KB
2026-03-11 16:18:51
R W Run
22.98 KB
2026-03-11 16:18:51
R W Run
10.66 KB
2026-03-11 16:18:51
R W Run
error_log
📄class-wp-ms-users-list-table.php
1<?php
2/**
3 * List Table API: WP_MS_Users_List_Table class
4 *
5 * @package WordPress
6 * @subpackage Administration
7 * @since 3.1.0
8 */
9
10/**
11 * Core class used to implement displaying users in a list table for the network admin.
12 *
13 * @since 3.1.0
14 *
15 * @see WP_List_Table
16 */
17class WP_MS_Users_List_Table extends WP_List_Table {
18 /**
19 * @return bool
20 */
21 public function ajax_user_can() {
22 return current_user_can( 'manage_network_users' );
23 }
24
25 /**
26 * @global string $mode List table view mode.
27 * @global string $usersearch
28 * @global string $role
29 */
30 public function prepare_items() {
31 global $mode, $usersearch, $role;
32
33 if ( ! empty( $_REQUEST['mode'] ) ) {
34 $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list';
35 set_user_setting( 'network_users_list_mode', $mode );
36 } else {
37 $mode = get_user_setting( 'network_users_list_mode', 'list' );
38 }
39
40 $usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';
41
42 $users_per_page = $this->get_items_per_page( 'users_network_per_page' );
43
44 $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : '';
45
46 $paged = $this->get_pagenum();
47
48 $args = array(
49 'number' => $users_per_page,
50 'offset' => ( $paged - 1 ) * $users_per_page,
51 'search' => $usersearch,
52 'blog_id' => 0,
53 'fields' => 'all_with_meta',
54 );
55
56 if ( wp_is_large_network( 'users' ) ) {
57 $args['search'] = ltrim( $args['search'], '*' );
58 } elseif ( '' !== $args['search'] ) {
59 $args['search'] = trim( $args['search'], '*' );
60 $args['search'] = '*' . $args['search'] . '*';
61 }
62
63 if ( 'super' === $role ) {
64 $args['login__in'] = get_super_admins();
65 }
66
67 /*
68 * If the network is large and a search is not being performed,
69 * show only the latest users with no paging in order to avoid
70 * expensive count queries.
71 */
72 if ( ! $usersearch && wp_is_large_network( 'users' ) ) {
73 if ( ! isset( $_REQUEST['orderby'] ) ) {
74 $_GET['orderby'] = 'id';
75 $_REQUEST['orderby'] = 'id';
76 }
77 if ( ! isset( $_REQUEST['order'] ) ) {
78 $_GET['order'] = 'DESC';
79 $_REQUEST['order'] = 'DESC';
80 }
81 $args['count_total'] = false;
82 }
83
84 if ( isset( $_REQUEST['orderby'] ) ) {
85 $args['orderby'] = $_REQUEST['orderby'];
86 }
87
88 if ( isset( $_REQUEST['order'] ) ) {
89 $args['order'] = $_REQUEST['order'];
90 }
91
92 /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
93 $args = apply_filters( 'users_list_table_query_args', $args );
94
95 // Query the user IDs for this page.
96 $wp_user_search = new WP_User_Query( $args );
97
98 $this->items = $wp_user_search->get_results();
99
100 $this->set_pagination_args(
101 array(
102 'total_items' => $wp_user_search->get_total(),
103 'per_page' => $users_per_page,
104 )
105 );
106 }
107
108 /**
109 * @return array
110 */
111 protected function get_bulk_actions() {
112 $actions = array();
113 if ( current_user_can( 'delete_users' ) ) {
114 $actions['delete'] = __( 'Delete' );
115 }
116 $actions['spam'] = _x( 'Mark as spam', 'user' );
117 $actions['notspam'] = _x( 'Not spam', 'user' );
118
119 return $actions;
120 }
121
122 /**
123 */
124 public function no_items() {
125 _e( 'No users found.' );
126 }
127
128 /**
129 * @global string $role
130 * @return array
131 */
132 protected function get_views() {
133 global $role;
134
135 $total_users = get_user_count();
136 $super_admins = get_super_admins();
137 $total_admins = count( $super_admins );
138
139 $role_links = array();
140 $role_links['all'] = array(
141 'url' => network_admin_url( 'users.php' ),
142 'label' => sprintf(
143 /* translators: Number of users. */
144 _nx(
145 'All <span class="count">(%s)</span>',
146 'All <span class="count">(%s)</span>',
147 $total_users,
148 'users'
149 ),
150 number_format_i18n( $total_users )
151 ),
152 'current' => 'super' !== $role,
153 );
154
155 $role_links['super'] = array(
156 'url' => network_admin_url( 'users.php?role=super' ),
157 'label' => sprintf(
158 /* translators: Number of users. */
159 _n(
160 'Super Admin <span class="count">(%s)</span>',
161 'Super Admins <span class="count">(%s)</span>',
162 $total_admins
163 ),
164 number_format_i18n( $total_admins )
165 ),
166 'current' => 'super' === $role,
167 );
168
169 return $this->get_views_links( $role_links );
170 }
171
172 /**
173 * @global string $mode List table view mode.
174 *
175 * @param string $which
176 */
177 protected function pagination( $which ) {
178 global $mode;
179
180 parent::pagination( $which );
181
182 if ( 'top' === $which ) {
183 $this->view_switcher( $mode );
184 }
185 }
186
187 /**
188 * @return string[] Array of column titles keyed by their column name.
189 */
190 public function get_columns() {
191 $users_columns = array(
192 'cb' => '<input type="checkbox" />',
193 'username' => __( 'Username' ),
194 'name' => __( 'Name' ),
195 'email' => __( 'Email' ),
196 'registered' => _x( 'Registered', 'user' ),
197 'blogs' => __( 'Sites' ),
198 );
199 /**
200 * Filters the columns displayed in the Network Admin Users list table.
201 *
202 * @since MU (3.0.0)
203 *
204 * @param string[] $users_columns An array of user columns. Default 'cb', 'username',
205 * 'name', 'email', 'registered', 'blogs'.
206 */
207 return apply_filters( 'wpmu_users_columns', $users_columns );
208 }
209
210 /**
211 * @return array
212 */
213 protected function get_sortable_columns() {
214 return array(
215 'username' => array( 'login', false, __( 'Username' ), __( 'Table ordered by Username.' ), 'asc' ),
216 'name' => array( 'name', false, __( 'Name' ), __( 'Table ordered by Name.' ) ),
217 'email' => array( 'email', false, __( 'E-mail' ), __( 'Table ordered by E-mail.' ) ),
218 'registered' => array( 'id', false, _x( 'Registered', 'user' ), __( 'Table ordered by User Registered Date.' ) ),
219 );
220 }
221
222 /**
223 * Handles the checkbox column output.
224 *
225 * @since 4.3.0
226 * @since 5.9.0 Renamed `$user` to `$item` to match parent class for PHP 8 named parameter support.
227 *
228 * @param WP_User $item The current WP_User object.
229 */
230 public function column_cb( $item ) {
231 // Restores the more descriptive, specific name for use within this method.
232 $user = $item;
233
234 if ( is_super_admin( $user->ID ) ) {
235 return;
236 }
237 ?>
238 <input type="checkbox" id="blog_<?php echo $user->ID; ?>" name="allusers[]" value="<?php echo esc_attr( $user->ID ); ?>" />
239 <label for="blog_<?php echo $user->ID; ?>">
240 <span class="screen-reader-text">
241 <?php
242 /* translators: Hidden accessibility text. %s: User login. */
243 printf( __( 'Select %s' ), $user->user_login );
244 ?>
245 </span>
246 </label>
247 <?php
248 }
249
250 /**
251 * Handles the ID column output.
252 *
253 * @since 4.4.0
254 *
255 * @param WP_User $user The current WP_User object.
256 */
257 public function column_id( $user ) {
258 echo $user->ID;
259 }
260
261 /**
262 * Handles the username column output.
263 *
264 * @since 4.3.0
265 *
266 * @param WP_User $user The current WP_User object.
267 */
268 public function column_username( $user ) {
269 $super_admins = get_super_admins();
270 $avatar = get_avatar( $user->user_email, 32 );
271
272 echo $avatar;
273
274 if ( current_user_can( 'edit_user', $user->ID ) ) {
275 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
276 $edit = "<a href=\"{$edit_link}\">{$user->user_login}</a>";
277 } else {
278 $edit = $user->user_login;
279 }
280
281 ?>
282 <strong>
283 <?php
284 echo $edit;
285
286 if ( in_array( $user->user_login, $super_admins, true ) ) {
287 echo ' &mdash; ' . __( 'Super Admin' );
288 }
289 ?>
290 </strong>
291 <?php
292 }
293
294 /**
295 * Handles the name column output.
296 *
297 * @since 4.3.0
298 *
299 * @param WP_User $user The current WP_User object.
300 */
301 public function column_name( $user ) {
302 if ( $user->first_name && $user->last_name ) {
303 printf(
304 /* translators: 1: User's first name, 2: Last name. */
305 _x( '%1$s %2$s', 'Display name based on first name and last name' ),
306 $user->first_name,
307 $user->last_name
308 );
309 } elseif ( $user->first_name ) {
310 echo $user->first_name;
311 } elseif ( $user->last_name ) {
312 echo $user->last_name;
313 } else {
314 echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' .
315 /* translators: Hidden accessibility text. */
316 _x( 'Unknown', 'name' ) .
317 '</span>';
318 }
319 }
320
321 /**
322 * Handles the email column output.
323 *
324 * @since 4.3.0
325 *
326 * @param WP_User $user The current WP_User object.
327 */
328 public function column_email( $user ) {
329 echo "<a href='" . esc_url( "mailto:$user->user_email" ) . "'>$user->user_email</a>";
330 }
331
332 /**
333 * Handles the registered date column output.
334 *
335 * @since 4.3.0
336 *
337 * @global string $mode List table view mode.
338 *
339 * @param WP_User $user The current WP_User object.
340 */
341 public function column_registered( $user ) {
342 global $mode;
343 if ( 'list' === $mode ) {
344 $date = __( 'Y/m/d' );
345 } else {
346 $date = __( 'Y/m/d g:i:s a' );
347 }
348 echo mysql2date( $date, $user->user_registered );
349 }
350
351 /**
352 * @since 4.3.0
353 *
354 * @param WP_User $user
355 * @param string $classes
356 * @param string $data
357 * @param string $primary
358 */
359 protected function _column_blogs( $user, $classes, $data, $primary ) {
360 echo '<td class="', $classes, ' has-row-actions" ', $data, '>';
361 echo $this->column_blogs( $user );
362 echo $this->handle_row_actions( $user, 'blogs', $primary );
363 echo '</td>';
364 }
365
366 /**
367 * Handles the sites column output.
368 *
369 * @since 4.3.0
370 *
371 * @param WP_User $user The current WP_User object.
372 */
373 public function column_blogs( $user ) {
374 $blogs = get_blogs_of_user( $user->ID, true );
375 if ( ! is_array( $blogs ) ) {
376 return;
377 }
378
379 foreach ( $blogs as $site ) {
380 if ( ! can_edit_network( $site->site_id ) ) {
381 continue;
382 }
383
384 $path = ( '/' === $site->path ) ? '' : $site->path;
385 $site_classes = array( 'site-' . $site->site_id );
386
387 /**
388 * Filters the span class for a site listing on the multisite user list table.
389 *
390 * @since 5.2.0
391 *
392 * @param string[] $site_classes Array of class names used within the span tag.
393 * Default "site-#" with the site's network ID.
394 * @param int $site_id Site ID.
395 * @param int $network_id Network ID.
396 * @param WP_User $user WP_User object.
397 */
398 $site_classes = apply_filters( 'ms_user_list_site_class', $site_classes, $site->userblog_id, $site->site_id, $user );
399
400 if ( is_array( $site_classes ) && ! empty( $site_classes ) ) {
401 $site_classes = array_map( 'sanitize_html_class', array_unique( $site_classes ) );
402 echo '<span class="' . esc_attr( implode( ' ', $site_classes ) ) . '">';
403 } else {
404 echo '<span>';
405 }
406
407 echo '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $site->userblog_id ) ) . '">' . str_replace( '.' . get_network()->domain, '', $site->domain . $path ) . '</a>';
408 echo ' <small class="row-actions">';
409
410 $actions = array();
411 $actions['edit'] = '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $site->userblog_id ) ) . '">' . __( 'Edit' ) . '</a>';
412
413 $class = '';
414 if ( 1 === (int) $site->spam ) {
415 $class .= 'site-spammed ';
416 }
417 if ( 1 === (int) $site->mature ) {
418 $class .= 'site-mature ';
419 }
420 if ( 1 === (int) $site->deleted ) {
421 $class .= 'site-deleted ';
422 }
423 if ( 1 === (int) $site->archived ) {
424 $class .= 'site-archived ';
425 }
426
427 $actions['view'] = '<a class="' . $class . '" href="' . esc_url( get_home_url( $site->userblog_id ) ) . '">' . __( 'View' ) . '</a>';
428
429 /**
430 * Filters the action links displayed next the sites a user belongs to
431 * in the Network Admin Users list table.
432 *
433 * @since 3.1.0
434 *
435 * @param string[] $actions An array of action links to be displayed. Default 'Edit', 'View'.
436 * @param int $userblog_id The site ID.
437 */
438 $actions = apply_filters( 'ms_user_list_site_actions', $actions, $site->userblog_id );
439
440 $action_count = count( $actions );
441
442 $i = 0;
443
444 foreach ( $actions as $action => $link ) {
445 ++$i;
446
447 $separator = ( $i < $action_count ) ? ' | ' : '';
448
449 echo "<span class='$action'>{$link}{$separator}</span>";
450 }
451
452 echo '</small></span><br />';
453 }
454 }
455
456 /**
457 * Handles the default column output.
458 *
459 * @since 4.3.0
460 * @since 5.9.0 Renamed `$user` to `$item` to match parent class for PHP 8 named parameter support.
461 *
462 * @param WP_User $item The current WP_User object.
463 * @param string $column_name The current column name.
464 */
465 public function column_default( $item, $column_name ) {
466 // Restores the more descriptive, specific name for use within this method.
467 $user = $item;
468
469 /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
470 $column_output = apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID );
471
472 /**
473 * Filters the display output of custom columns in the Network Users list table.
474 *
475 * @since 6.8.0
476 *
477 * @param string $output Custom column output. Default empty.
478 * @param string $column_name Name of the custom column.
479 * @param int $user_id ID of the currently-listed user.
480 */
481 echo apply_filters( 'manage_users-network_custom_column', $column_output, $column_name, $user->ID );
482 }
483
484 /**
485 * Generates the list table rows.
486 *
487 * @since 3.1.0
488 */
489 public function display_rows() {
490 foreach ( $this->items as $user ) {
491 $class = '';
492
493 $status_list = array(
494 'spam' => 'site-spammed',
495 'deleted' => 'site-deleted',
496 );
497
498 foreach ( $status_list as $status => $col ) {
499 if ( $user->$status ) {
500 $class .= " $col";
501 }
502 }
503
504 ?>
505 <tr class="<?php echo trim( $class ); ?>">
506 <?php $this->single_row_columns( $user ); ?>
507 </tr>
508 <?php
509 }
510 }
511
512 /**
513 * Gets the name of the default primary column.
514 *
515 * @since 4.3.0
516 *
517 * @return string Name of the default primary column, in this case, 'username'.
518 */
519 protected function get_default_primary_column_name() {
520 return 'username';
521 }
522
523 /**
524 * Generates and displays row action links.
525 *
526 * @since 4.3.0
527 * @since 5.9.0 Renamed `$user` to `$item` to match parent class for PHP 8 named parameter support.
528 *
529 * @param WP_User $item User being acted upon.
530 * @param string $column_name Current column name.
531 * @param string $primary Primary column name.
532 * @return string Row actions output for users in Multisite, or an empty string
533 * if the current column is not the primary column.
534 */
535 protected function handle_row_actions( $item, $column_name, $primary ) {
536 if ( $primary !== $column_name ) {
537 return '';
538 }
539
540 // Restores the more descriptive, specific name for use within this method.
541 $user = $item;
542
543 $super_admins = get_super_admins();
544 $actions = array();
545
546 if ( current_user_can( 'edit_user', $user->ID ) ) {
547 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
548 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
549 }
550
551 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins, true ) ) {
552 $actions['delete'] = '<a href="' . esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&amp;action=deleteuser&amp;id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
553 }
554
555 /**
556 * Filters the action links displayed under each user in the Network Admin Users list table.
557 *
558 * @since 3.2.0
559 *
560 * @param string[] $actions An array of action links to be displayed. Default 'Edit', 'Delete'.
561 * @param WP_User $user WP_User object.
562 */
563 $actions = apply_filters( 'ms_user_row_actions', $actions, $user );
564
565 return $this->row_actions( $actions );
566 }
567}
568
Ui Ux Design – Teachers Night Out

Get in Touch

© 2024 Teachers Night Out. All Rights Reserved.