aicomp
Forum Replies Created
-
The code snippet worked in the past. It was needed that the user has to confirm the initial registration (double opt-in). After that the user gets an email being informed that I (admin) will review the registration (registration pending – approval needed). After given approval the user gets a final confirmation of being successfully registered.
The rest of the code relies on better usability for the user informing if an email address (user) is already registered. This works as expected.
Now, the manual admin approval step doesn’t work anymore. After the registration the user clicks the confirmation email link and will be redirected to the profile. With that the registration is approved automatically. But I need the manual approval step back.
See the code below. Unfortunately, the changes didn’t work. I also cleared the cache afterwards.
add_action( 'um_after_email_confirmation', 'um_after_email_confirmation_admin_approval', 10, 1 );
function um_after_email_confirmation_admin_approval( $user_id ) {
um_fetch_user( $user_id );
UM()->common()->users()->set_as_pending( $user_id, $force );
}
add_action( 'um_submit_form_errors_hook_logincheck', 'my_submit_form_errors_hook_logincheck', 10, 1 );
function my_submit_form_errors_hook_logincheck( $args ) {
$user_id = ( isset( UM()->login()->auth_id ) ) ? UM()->login()->auth_id : '';
um_fetch_user( $user_id );
$status = um_user( 'account_status' );
if( $status == 'awaiting_email_confirmation' ) {
UM()->common()->users()->set_as_pending( $user_id, $force );
um_reset_user();
exit( wp_redirect( add_query_arg( 'err', esc_attr( 'awaiting_new_email_confirmation' ), UM()->permalinks()->get_current_url() ) ) );
}
}
add_filter( 'um_custom_error_message_handler', 'my_custom_error_message_handler', 999, 2 );
function my_custom_error_message_handler( $err, $error ) {
if( $error == 'awaiting_new_email_confirmation' ) {
return __( 'Your account is awaiting e-mail verification and we have now sent you a new e-mail for verification.', 'ultimate-member' );
} else {
return $err;
}
}
/**
* Custom validation and error message for the E-mail Address field.
*/
add_action( 'um_custom_field_validation_user_email_details', 'um_custom_validate_user_email_details', 999, 3 );
function um_custom_validate_user_email_details( $key, $array, $args ) {
if ( $key == 'user_email' && isset( $args['user_email'] ) ) {
if ( isset( UM()->form()->errors['user_email'] ) ) {
unset( UM()->form()->errors['user_email'] );
}
if ( empty( $args['user_email'] ) ) {
UM()->form()->add_error( 'user_email', __( 'E-mail Address is required', 'ultimate-member' ) );
} elseif ( ! is_email( $args['user_email'] ) ) {
UM()->form()->add_error( 'user_email', __( 'The email you entered is invalid', 'ultimate-member' ) );
} elseif ( email_exists( $args['user_email'] ) ) {
UM()->form()->add_error( 'user_email', __( 'The email you entered is already registered', 'ultimate-member' ) );
}
}
}
/**
* Doubled validation and error message for the E-mail Address field.
*/
add_action( 'um_submit_form_errors_hook', 'confirm_user_email_textbox', 100, 1 );
function confirm_user_email_textbox( $args ){
if ( isset( $args['user_email'] ) && isset( $args['confirm_user_email'] ) && $args['confirm_user_email'] != $args['user_email'] ) {
UM()->form()->add_error( 'user_email', 'Your email addresses are different' );
UM()->form()->add_error( 'confirm_user_email', 'Your email addresses are different' );
}
}Thank you. That’s exactly what I was looking for.
Got it…Thanks for your support.
Thank you. I have some smaller issues. To make the form submission possible for logged-in user as well as not logged-in users, which initial option should I choose? Does the anonymous option work if I don’t further specify any information to the known and unknown user? Or is it here better to setup 2 automations? If so, any chance to copy the setup from one initial scenario to another?
And I have one select type field which has the same options in the ACF as well as in the Elementor form. But that data will not be synced. The same here with in the form uploaded pictures. Any chance to get that data synced?
Thank you for the fast reply. One more question. I have multiple custom fields in that custom post type and don’t use any standard fields like Content or Excerpt. Can I link the data from the form via the Post Meta Key settings? Or do I need another workaround with ACF as an additional action?
cool…thank you
Thank you. Does it send the automated approval email after admin approved the registration? Just want to ensure that the communication for the user is clear.
Thanks
another update: Autooptimize is responsible for that error.
Any idea which settings make sense there?
another update: Web Hosting doesn’t block anything here
Hi, I found out that settings in htaccess where responsible for the strange window behaviour. That is fixed. I can now upload the picture. But when I try to apply the cropping for that picture javascript seems to be blocked. I disabled JS caching to test that. Didn’t help. In the Dev Tools I get that error:
Uncaught TypeError: Cannot read properties of undefined (reading ‘scaleX’)
at n.getData (cropper.min.js:10:25897)
at HTMLAnchorElement. (um-modal.min.js:1:1666)
at HTMLDocument.dispatch (jquery.min.js:2:40035)
at v.handle (jquery.min.js:2:38006)
getData @ cropper.min.js:10
(anonymous) @ um-modal.min.js:1
dispatch @ jquery.min.js:2
v.handle @ jquery.min.js:2any other idea?
Just as an update. I had the same critical error. Deleting all Matomo plugins and re-installing them helped to solve that problem.
conflict test via staging site. Theme 2024. Error still persists.
Okay…need to check it over the next days due to workload.
First Check of JavaScript errors:
Failed to load resource: the server responded with a status of 403 (Forbidden)
um-functions.min.js:1 Uncaught TypeError: d.uploadFile is not a function
at initImageUpload_UM (um-functions.min.js:1:2613)
at um_new_modal (um-functions.min.js:1:7344)
at HTMLAnchorElement. (um-modal.min.js:1:4103)
at HTMLBodyElement.dispatch (jquery.min.js:2:40035)
at v.handle (jquery.min.js:2:38006)
at Object.trigger (jquery.min.js:2:70124)
at HTMLAnchorElement. (jquery.min.js:2:70726)
at Function.each (jquery.min.js:2:3129)
at e.<computed>.each (jquery.min.js:2:1594)
at e.<computed>.trigger (jquery.min.js:2:70701)Checked in troubleshooting mode (UM + Hello Theme) and disabled Cache enabler. Doesn’t help. The problem stays as described.