Created
October 1, 2022 12:17
-
-
Save svenl77/6d929790554ceeccd08ad18e2b5d9622 to your computer and use it in GitHub Desktop.
Add All In One invite Codes Validation to a Ultimate Member Registration Field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Validate field Mobile Number | |
* @param string $key | |
* @param attay $array | |
* @param array $args | |
*/ | |
function um_custom_validate_invite_code( $key, $array, $args ) { | |
if(!function_exists('all_in_one_invite_codes_validate_code')){ | |
return; | |
} | |
if ( isset( $args[$key] ) ) { | |
$result = all_in_one_invite_codes_validate_code( $args[$key], $args['user_mail'], ); | |
if ( isset( $result['error'] ) ) { | |
UM()->form()->add_error( $key, $result['error'] ); | |
} | |
} | |
} | |
add_action( 'um_custom_field_validation_invite_code', 'um_custom_validate_invite_code', 30, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello, I have implemented this function following the guide and it works up to the check, however when I click on the register button it goes into error and does not create the account, what could be the cause of this error? if I delete the poersonalised field of the invitation code from the form instead it works.
Thank you