WC_Admin_API_Keys::bulk_actions()privateWC 1.0

Bulk actions.

Method of the class: WC_Admin_API_Keys{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->bulk_actions();

WC_Admin_API_Keys::bulk_actions() code WC 8.7.0

private function bulk_actions() {
	check_admin_referer( 'woocommerce-settings' );

	if ( ! current_user_can( 'manage_woocommerce' ) ) {
		wp_die( esc_html__( 'You do not have permission to edit API Keys', 'woocommerce' ) );
	}

	if ( isset( $_REQUEST['action'] ) ) { // WPCS: input var okay, CSRF ok.
		$action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ); // WPCS: input var okay, CSRF ok.
		$keys   = isset( $_REQUEST['key'] ) ? array_map( 'absint', (array) $_REQUEST['key'] ) : array(); // WPCS: input var okay, CSRF ok.

		if ( 'revoke' === $action ) {
			$this->bulk_revoke_key( $keys );
		}
	}
}