PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.10
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.10
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 0.8.8 0.8.7 All 34 releases
← All changes | includes/agents/identity.php +18 -2 1.1.11.1.10 View file →
@@ -149,9 +149,25 @@
149 149 if ( ! function_exists( 'wp_delete_user' ) ) {
150 150 require_once ABSPATH . 'wp-admin/includes/user.php';
151 151 }
152 152
153 - $deleted = wp_delete_user( (int) $user_id, $reassign );
153 + // On multisite `wp_delete_user()` only removes the user from the
154 + // CURRENT site — the network account (and the agent's meta with
155 + // it) lives on. The agent's whole identity is its wp user, so
156 + // deleting the agent means the network-wide delete.
157 + if ( is_multisite() ) {
158 + if ( ! function_exists( 'wpmu_delete_user' ) ) {
159 + require_once ABSPATH . 'wp-admin/includes/ms.php';
160 + }
161 + if ( null !== $reassign ) {
162 + // `wpmu_delete_user()` has no reassign parameter; hand the
163 + // current site's content over before the user goes.
164 + wp_delete_user( (int) $user_id, $reassign );
165 + }
166 + $deleted = wpmu_delete_user( (int) $user_id );
167 + } else {
168 + $deleted = wp_delete_user( (int) $user_id, $reassign );
169 + }
154 170 if ( ! $deleted ) {
155 171 return new WP_Error(
156 172 'openstation_agent_delete_failed',
157 173 __( 'Could not delete the agent user.', 'desktop-mode' )
@@ -199,9 +215,9 @@
199 215 }
200 216 }
201 217
202 218 if ( $user_id > 0 && openstation_agent_is_agent( $user_id ) ) {
203 - $args['url'] = openstation_agent_avatar_url();
219 + $args['url'] = openstation_agent_avatar_url( $user_id );
204 220 $args['found_avatar'] = true;
205 221 }
206 222 return $args;
207 223 }