XProfile_Data::delete( $args, $assoc_args )
Delete XProfile data for a user.
Description Description
OPTIONS OPTIONS
–user-id=
[–field-id=
[–delete-all] : Delete all data for the user.
[–yes] : Answer yes to the confirmation message.
EXAMPLES EXAMPLES
$ wp bp xprofile data delete --user-id=45 --field-id=120 --yes
Success: XProfile data removed.
$ wp bp xprofile data remove --user-id=user_test --delete-all --yes
Success: XProfile data removed.
Source Source
File: cli/src/xprofile-data.php
public function delete( $args, $assoc_args ) { $user = $this->get_user_id_from_identifier( $assoc_args['user-id'] ); if ( ! isset( $assoc_args['field-id'] ) && ! isset( $assoc_args['delete-all'] ) ) { WP_CLI::error( 'Either --field-id or --delete-all must be provided.' ); } if ( isset( $assoc_args['delete-all'] ) ) { WP_CLI::confirm( sprintf( 'Are you sure you want to delete all XProfile data for the user %s (#%d)?', $user->user_login, $user->ID ), $assoc_args ); xprofile_remove_data( $user->ID ); WP_CLI::success( 'XProfile data removed.' ); } else { WP_CLI::confirm( 'Are you sure you want to delete that?', $assoc_args ); if ( xprofile_delete_field_data( $assoc_args['field-id'], $user->ID ) ) { WP_CLI::success( 'XProfile data removed.' ); } else { WP_CLI::error( 'Could not delete XProfile data.' ); } } }
Expand full source code Collapse full source code View on Trac