@@ -289,11 +289,11 @@ function ( $user ) use ( $network, $reassign ) {
289289 $ message = "Removed user {$ user_id } from " . home_url () . '. ' ;
290290 }
291291
292- if ( $ result ) {
293- return [ 'success ' , $ message ];
294- } else {
292+ if ( ! $ result ) {
295293 return [ 'error ' , "Failed deleting user {$ user_id }. " ];
296294 }
295+
296+ return [ 'success ' , $ message ];
297297 }
298298 );
299299 }
@@ -936,13 +936,17 @@ public function import_csv( $args, $assoc_args ) {
936936 foreach ( $ file_object as $ line ) {
937937 if ( empty ( $ line [0 ] ) ) {
938938 continue ;
939- } elseif ( empty ( $ indexes ) ) {
939+ }
940+
941+ if ( empty ( $ indexes ) ) {
940942 $ indexes = $ line ;
941943 continue ;
942944 }
945+
943946 foreach ( $ indexes as $ n => $ key ) {
944947 $ data [ $ key ] = $ line [ $ n ];
945948 }
949+
946950 $ csv_data [] = $ data ;
947951 }
948952 } else {
@@ -993,8 +997,9 @@ public function import_csv( $args, $assoc_args ) {
993997 WP_CLI ::log ( "{$ existing_user ->user_login } exists and has been skipped. " );
994998 continue ;
995999
996- } elseif ( $ existing_user ) {
1000+ }
9971001
1002+ if ( $ existing_user ) {
9981003 $ new_user ['ID ' ] = $ existing_user ->ID ;
9991004 $ user_id = wp_update_user ( $ new_user );
10001005
@@ -1037,7 +1042,9 @@ public function import_csv( $args, $assoc_args ) {
10371042 WP_CLI ::warning ( $ user_id );
10381043 continue ;
10391044
1040- } elseif ( false === $ new_user ['role ' ] ) {
1045+ }
1046+
1047+ if ( false === $ new_user ['role ' ] ) {
10411048 delete_user_option ( $ user_id , 'capabilities ' );
10421049 delete_user_option ( $ user_id , 'user_level ' );
10431050 }
@@ -1179,11 +1186,8 @@ private function update_msuser_status( $user_ids, $pref, $value ) {
11791186 }
11801187
11811188 if ( 'spam ' === $ pref && '1 ' === $ value ) {
1182- $ action = 'marked as spam ' ;
1183- $ verb = 'spam ' ;
1184- } elseif ( 'spam ' === $ pref && '0 ' === $ value ) {
1185- $ action = 'removed from spam ' ;
1186- $ verb = 'unspam ' ;
1189+ $ action = (int ) $ value ? 'marked as spam ' : 'removed from spam ' ;
1190+ $ verb = (int ) $ value ? 'spam ' : 'unspam ' ;
11871191 }
11881192
11891193 $ successes = 0 ;
0 commit comments