@@ -228,12 +228,12 @@ public function activate( $args, $assoc_args ) {
228
228
}
229
229
230
230
/**
231
- * Deletes a signup .
231
+ * Deletes one or more signups .
232
232
*
233
233
* ## OPTIONS
234
234
*
235
- * <signup>
236
- * : Signup ID, user login, user email, or activation key.
235
+ * <signup>...
236
+ * : Signup ID, user login, user email, or activation key of the signup(s) to delete .
237
237
*
238
238
* ## EXAMPLES
239
239
*
@@ -244,16 +244,29 @@ public function activate( $args, $assoc_args ) {
244
244
* @package wp-cli
245
245
*/
246
246
public function delete ( $ args , $ assoc_args ) {
247
+ $ signups = $ this ->fetcher ->get_many ( $ args );
248
+
249
+ parent ::_delete ( $ signups , $ assoc_args , [ $ this , 'delete_callback ' ] );
250
+ }
251
+
252
+ /**
253
+ * Callback used to delete a signup.
254
+ *
255
+ * @param $signup
256
+ * @param $assoc_args
257
+ * @return array
258
+ */
259
+ protected function delete_callback ( $ signup , $ assoc_args ) {
247
260
global $ wpdb ;
248
261
249
- $ signup = $ this -> fetcher -> get_check ( $ args [ 0 ] ) ;
262
+ $ signup_id = $ signup -> signup_id ;
250
263
251
- $ result = $ wpdb ->delete ( $ wpdb ->signups , array ( 'signup_id ' => $ signup -> signup_id ), array ( '%d ' ) );
264
+ $ result = $ wpdb ->delete ( $ wpdb ->signups , array ( 'signup_id ' => $ signup_id ), array ( '%d ' ) );
252
265
253
266
if ( $ result ) {
254
- WP_CLI :: success ( "Signup {$ signup -> signup_id } deleted. " ) ;
267
+ return [ ' success ' , "Signup {$ signup_id } deleted. " ] ;
255
268
} else {
256
- WP_CLI :: error ( "Failed deleting signup {$ signup -> signup_id }. " ) ;
269
+ return [ ' error ' , "Failed deleting signup {$ signup_id }. " ] ;
257
270
}
258
271
}
259
272
}
0 commit comments