PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.12
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.12
1.1.12 1.1.11 1.1.10 1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 All 36 releases
← All changes | apps/users/users.os.php +49 -0 1.1.6 → 1.1.12 View file →
@@ -33,8 +33,10 @@
33 33 require_once __DIR__ . '/parts/permissions.php';
34 34 require_once __DIR__ . '/parts/login-tracker.php';
35 35 require_once __DIR__ . '/parts/color-schemes.php';
36 36 require_once __DIR__ . '/parts/fields.php';
37 +require_once __DIR__ . '/parts/roles-summary.php';
38 +require_once __DIR__ . '/parts/activity-summary.php';
37 39 require_once __DIR__ . '/parts/facts.php';
38 40 require_once __DIR__ . '/parts/rest.php';
39 41 require_once __DIR__ . '/parts/profile-script.php';
40 42
@@ -56,8 +58,16 @@
56 58 $search = trim( (string) $state->get( 'search' ) );
57 59 if ( '' !== $search ) {
58 60 $query['search'] = $search;
59 61 }
62 + $role = trim( (string) $state->get( 'role' ) );
63 + if ( 'none' === $role ) {
64 + // As users.php does: the accounts with no role on this site, or nobody.
65 + $ids = wp_get_users_with_no_role();
66 + $query['include'] = $ids ? array_map( 'intval', $ids ) : array( 0 );
67 + } elseif ( '' !== $role ) {
68 + $query['roles'] = $role;
69 + }
60 70 return $query;
61 71 }
62 72
63 73 /**
@@ -108,13 +118,48 @@
108 118 }
109 119 )
110 120 // Resolved when the window registers, for the viewer registering it.
111 121 ->config( 'openstation_users_profile_facts' )
122 + // The Users menu, while this window is the one answering for it:
123 + // the dock's submenu becomes these tabs, same labels, same order,
124 + // and picking one opens the window on it. The window's own strip
125 + // renders from the same list (`menuTabs` in the config extra), so
126 + // the two cannot drift.
127 + ->menu(
128 + 'users.php',
129 + static function () {
130 + $tabs = array(
131 + 'all' => array(
132 + 'label' => __( 'People', 'desktop-mode' ),
133 + 'page' => 'users.php',
134 + ),
135 + 'roles' => __( 'Roles', 'desktop-mode' ),
136 + 'activity' => __( 'Activity', 'desktop-mode' ),
137 + );
138 + if ( current_user_can( 'create_users' ) ) {
139 + $tabs['add-new'] = array(
140 + 'label' => __( 'Add new', 'desktop-mode' ),
141 + 'page' => 'user-new.php',
142 + );
143 + }
144 + $tabs['edit'] = array(
145 + 'label' => __( 'Profile', 'desktop-mode' ),
146 + 'page' => 'profile.php',
147 + );
148 + return $tabs;
149 + },
150 + 'openstation_users_window_user_can_use'
151 + )
112 152 ->state(
113 153 array(
114 154 'page' => 1,
115 155 'perPage' => 20,
116 156 'search' => '',
157 + // The role filter: a slug, or `none` for accounts with no
158 + // role on this site, as `users.php?role=none` spells it. A
159 + // server-side scope, so a group picked on the Roles tab is
160 + // a fresh collection rather than a slice of the loaded pages.
161 + 'role' => '',
117 162 // The presence filter (All / Online / Active 30d / Never
118 163 // logged in) — a client-side slice of the page.
119 164 'status' => '',
120 165 'orderby' => 'name',
@@ -283,8 +328,12 @@
283 328 foreach ( $list['items'] as $i => $row ) {
284 329 $id = isset( $row['id'] ) ? (int) $row['id'] : 0;
285 330 if ( isset( $stats[ $id ] ) ) {
286 331 $list['items'][ $i ]['openstation_user_stats'] = $stats[ $id ];
332 + }
333 + // Core's row carries the name as stored (`&`); the view paints text.
334 + if ( isset( $row['name'] ) ) {
335 + $list['items'][ $i ]['name'] = openstation_plain_text_title( $row['name'] );
287 336 }
288 337 }
289 338 return array( 'list' => $list );
290 339 }