Skip to content

Instantly share code, notes, and snippets.

@ultimatemember
Last active April 4, 2018 14:20
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ultimatemember/08c7f3369f49021cb749 to your computer and use it in GitHub Desktop.
Save ultimatemember/08c7f3369f49021cb749 to your computer and use it in GitHub Desktop.
How to stop registration using Ultimate Member action hooks
/*
You need to hook into um_submit_form_errors_hook with a
priority over 10.
You can stop registration here if the customer_code field does not
match the value you want "ALLOWED_VALUE" in this example
*/
add_action('um_submit_form_errors_hook', 'check_customer_code', 100 );
function check_customer_code( $args ){
if ( $args['customer_code'] != 'ALLOWED_VALUE' ) {
exit( wp_redirect( add_query_arg('err', 'invalid_customer_code') ) );
}
}
@SaeedSoltoon
Copy link

hi,thanks for your code example. where we should put this code to work?

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