Skip to content

Instantly share code, notes, and snippets.

@svenl77
Created October 1, 2022 12:17
Show Gist options
  • Save svenl77/6d929790554ceeccd08ad18e2b5d9622 to your computer and use it in GitHub Desktop.
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
<?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 );
@PippoBlanco
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment