Invite code snippet not working after 2.0.x update
-
Snippet code no longer working. Code adds the following to a Ultimate Member user role, specifically assigned registration form:
A text field to input a required invite code in order to register. Not an ideal solution. Not scalable. Not the most elequent solution but for private beta it will do.
The snippet worked prior to plugin developer rewriting the Ultimate Member plugin from the ground up to version 2.0.
It looks like the hook as follows — um_submit_form_errors_hook — still exists. Ultimate Member’s site has a developer page and I couldn’t find anything notes.
My desired action: Have the page throw up an error message saying invalid invite code and not let the person register.
Right now if the text field is empty, an error message pops up. Enter any code at least 6 digits long and it lets you register assigning you the user role of booking merchant.
Anyone see anything basic jumping out screaming “mistake” in my code? Thanks in advance for taking a look.
// Ultimate Members snippets // // https://docs.ultimatemember.com/article/68-stop-registration-if-customercode-field-does-not-equal-abcde add_action('um_submit_form_errors_hook', 'j66_check_merchant_invite_code', 100 ); function j66_check_merchant_invite_code( $args ){ global $ultimatemember; if ( isset( $args['booking_merchant_code'] ) && $args['booking_merchant_code'] != 'ABCDEchangeThis' ) $ultimatemember->form->add_error( 'booking_merchant_code', 'Booking merchant invite code required. Please enter a valid code.' ); exit( wp_redirect( add_query_arg('err', 'invalid_booking_merchant_code') ) ); }
- The topic ‘Invite code snippet not working after 2.0.x update’ is closed to new replies.