LLMS_Form_Validator::validate_field_voucher( string $posted_value )
Validate a voucher field ensuring it’s a valid and usable voucher code
Parameters Parameters
- $posted_value
-
(string) (Required) User-submitted (dirty) value.
Return Return
(WP_Error|boolean) Returns true for a valid submission, otherwise an error.
Source Source
File: includes/forms/class-llms-form-validator.php
protected function validate_field_voucher( $posted_value ) {
$voucher = new LLMS_Voucher();
$check = $voucher->check_voucher( $posted_value );
if ( is_wp_error( $check ) ) {
return new WP_Error( 'llms-form-field-invalid', $check->get_error_message(), array( $posted_value, $check ) );
}
return true;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 5.0.0 | Introduced. |