Action
rpress_checkout_user_error_checks
On this page
Fires after the checkout user has been resolved so extensions can validate user-dependent fields.
Runs in rpress_process_purchase_form() after the checkout login form (when submitted) has been processed and the purchase user has been determined, and before the function checks for errors and stops. Use it for checks that need the logged-in or newly resolved user. Call rpress_set_error() to block the order.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$user | array|bool | The purchasing user data array, true for AJAX validation requests, or false when no user could be resolved. |
$valid_data | array|false | Validated data from rpress_purchase_form_validate_fields(), or false. |
$data | array | Sanitized copy of $_POST. |
Example#
add_action( 'rpress_checkout_user_error_checks', 'my_block_flagged_users', 10, 3 );
function my_block_flagged_users( $user, $valid_data, $data ) {
if ( is_array( $user ) && ! empty( $user['user_id'] ) && get_user_meta( $user['user_id'], 'my_blocked', true ) ) {
rpress_set_error( 'my_blocked', __( 'Orders from this account are disabled.', 'my-plugin' ) );
}
}
Notes#
Fires on both the AJAX validation request and the final submission.
Source#
Fired from:
includes/process-purchase.php(line 135), inrpress_process_purchase_form()
See also#
Was this page helpful?
