This commit is contained in:
Javier Casares 2026-06-06 05:08:20 +00:00
commit 054060374e

View file

@ -310,6 +310,37 @@ class Cli_Command extends WP_CLI_Command {
\WP_CLI\Utils\format_items( 'table', $rows, array( 'ID', 'Login', 'Email', '2FA', 'Frequency' ) );
}
/**
* Export a full 2FA status report for all users.
*
* Equivalent to `wp 2fa list --format=csv` but outputs to stdout for easy
* redirection to a file.
*
* ## OPTIONS
*
* [--role=<role>]
* : Restrict export to a specific WordPress role.
*
* [--without-2fa]
* : Include only users who do not have 2FA enabled.
*
* ## EXAMPLES
*
* wp 2fa export > 2fa-audit.csv
* wp 2fa export --role=editor > editors.csv
*
* @since 1.5.0
*
* @param array<int, string> $args Positional arguments.
* @param array<string, string> $assoc_args Associative arguments.
*
* @return void
*/
public function export( array $args, array $assoc_args ): void {
$assoc_args['format'] = 'csv';
$this->list_users( $args, $assoc_args );
}
/**
* Enforce 2FA for a specific user or all users of a role.
*