Its now considered bad practice to send the password to the user via un-secure email.
WordPress core changed how users are created so now the user must use the reset password link provided within the email WP sends out when EE creates the user.
What happens when the user click on the set password link?
Is there an event I can run a registration on to view an example?
When the user gets sent the email and clicks on the link you get the reset password page but immediately it says:
‘Sorry, your password must have a minimum of 7 characters’
Then when you ignore that and try to set a password or use the password generated, the button doesn’t work and it doesn’t actually set a password.
Not that I know of, And we’ve switched off the caching by our host as it was conflicting with development before.
There has been some actions added to the child themes function php to get the registration forms working. and a plugin for woocommerce password strength.
//1. Add a new form element...
add_action( 'register_form', 'myplugin_register_form' );
function myplugin_register_form() {
$first_name = ( ! empty( $_POST['first_name'] ) ) ? trim( $_POST['first_name'] ) : '';
$last_name = ( ! empty( $_POST['last_name'] ) ) ? trim( $_POST['last_name'] ) : '';
?>
<p class="form-row form-row-first">
<label for="first_name"><?php _e( 'First Name', 'mydomain' ) ?><span class="required"> *</span><br />
<input type="text" name="first_name" id="first_name" class="input-text" value="<?php echo esc_attr( wp_unslash( $first_name ) ); ?>" size="25" /></label>
</p>
<p class="form-row form-row-last">
<label for="last_name"><?php _e( 'Last Name', 'mydomain' ) ?><span class="required"> *</span><br />
<input type="text" name="last_name" id="last_name" class="input-text" value="<?php echo esc_attr( wp_unslash( $last_name ) ); ?>" size="25" /></label>
</p>
<p style="display: inline-block; font-size: 0.8em; margin-bottom: 10px;">
* By registering for an account, You agree to be signed up to our mailing list. You may unsubscribe at any time.
</p><br/>
<?php
}
//2. Add validation. In this case, we make sure first_name is required.
add_filter( 'registration_errors', 'myplugin_registration_errors', 10, 3 );
function myplugin_registration_errors( $errors, $sanitized_user_login, $user_email ) {
if ( empty( $_POST['first_name'] ) || ! empty( $_POST['first_name'] ) && trim( $_POST['first_name'] ) == '' ) {
$errors->add( 'first_name_error', __( '<strong>ERROR</strong>: You must include a first name.', 'mydomain' ) );
}
if ( empty( $_POST['last_name'] ) || ! empty( $_POST['last_name'] ) && trim( $_POST['last_name'] ) == '' ) {
$errors->add( 'last_name_error', __( '<strong>ERROR</strong>: You must include a last name.', 'mydomain' ) );
}
return $errors;
}
//2.1. Add validation for woocommerce register form.
function wooc_validate_extra_register_fields( $username, $email, $validation_errors ) {
if ( isset( $_POST['first_name'] ) && empty( $_POST['first_name'] ) ) {
$validation_errors->add( 'first_name_error2', __( 'First name is required!', 'woocommerce' ) );
}
if ( isset( $_POST['last_name'] ) && empty( $_POST['last_name'] ) ) {
$validation_errors->add( 'last_name_error2', __( 'Last name is required!.', 'woocommerce' ) );
}
}
add_action( 'woocommerce_register_post', 'wooc_validate_extra_register_fields', 10, 3 );
//3. Finally, save our extra registration user meta.
add_action( 'user_register', 'myplugin_user_register' );
function myplugin_user_register( $user_id ) {
if ( ! empty( $_POST['first_name'] ) ) {
update_user_meta( $user_id, 'first_name', trim( $_POST['first_name'] ) );
}
if ( ! empty( $_POST['last_name'] ) ) {
update_user_meta( $user_id, 'last_name', trim( $_POST['last_name'] ) );
}
}
//Add hooks to change the password strength messages.
add_action( 'wp_enqueue_scripts', 'my_strength_meter_localize_script' );
function my_strength_meter_localize_script() {
wp_localize_script( 'password-strength-meter', 'pwsL10n', array(
'empty' => __( 'Password is empty!', 'theme-domain' ),
'short' => __( 'Weak', 'theme-domain' ),
'bad' => __( 'Okay ', 'theme-domain' ),
'good' => __( 'Good', 'theme-domain' ),
'strong' => __( 'Excellent', 'theme-domain' ),
'mismatch' => __( 'Password mismatch', 'theme-domain' )
) );
}
add_filter( 'wc_password_strength_meter_params', 'my_strength_meter_custom_strings' );
function my_strength_meter_custom_strings( $data ) {
$data_new = array(
'i18n_password_error' => esc_attr__( 'We recommend a stronger password', 'theme-domain' ),
'i18n_password_hint' => esc_attr__( 'The password should be at least seven characters long.', 'theme-domain' )
);
return array_merge( $data, $data_new );
}
function change_register_url($link){
$link = "<a href='http://contentmanagementwebsite.co.uk/keep_active/my-account/'>Register</a>";
/*
Change wp registration url
*/
return str_replace(site_url('wp-login.php?action=register', 'login'),site_url('register', 'login'),$link);
}
add_filter('register','change_register_url');
It turns out that Event Espresso 4’s WP User Integration add-on doesn’t have a feature where it lets the ticket buyer set the password when they buy the ticket.
Viewing 7 reply threads
The support post ‘Automatically generated password after registering’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.