Custom registration function not working as it should because is_mail and email_exist keep giving errors when it shouldn’t

Because there is context lacking I’m not able to fix all your problems. One of the mistakes I see is that in your code this line: if (email_exists($email) === false) { $errors[] = ‘E-mail address is already in use.’; } Must be: if(email_exists($email)){ etc. Because you check whether the email_exists function returns an ID when … Read more

wp_insert_user if user exists

When updating a user with: $user_id = wp_update_user( $userdata ); you need to have the user ID set within $userdata. Also make sure to validate the $user_id output of wp_update_user() as it can be either an integer or an instance of WP_Error, before using it in update_user_meta(). One can use is_wp_error( $user_id ) to check … Read more

Is it possible to remove the password field in the registration page in woocommerce?

Use this snippet to create user without password $website = “http://example.com”; $userdata = array( ‘user_login’ => ‘login_name’, ‘user_url’ => $website, ‘user_pass’ => NULL // When creating an user, password is expected. ); $user_id = wp_insert_user( $userdata ) ; //after this you can update user on this way update_user_meta( $user_id, ‘some_meta_key’, $meta_value ); or //create user … Read more

How can I fetch user registration age

Solved the above task, posting the answer here so that someone can use the code I added this code in functions.php function is_user_video_perweek( $reg_days_ago ) { $currentuser = wp_get_current_user(); return ( isset( $currentuser->data->user_registered ) && strtotime( $currentuser->data->user_registered ) < strtotime( sprintf( ‘-%d days’, $reg_days_ago ) ) ); } and then in footer.php I called this … Read more

Creating custom registration and login page in wordpress

Try following Code: <?php $c_user = wp_get_current_user(); if( !is_user_logged_in( $c_user->ID ) ) : wp_register(”, “https://wordpress.stackexchange.com/”); echo ‘<a href=”‘ . esc_url( wp_login_url() ) . ‘” alt=”‘ . esc_attr( ‘Login’, ‘textdomain’ ) . ‘”>’; echo _e( ‘Login’, ‘textdomain’ ); echo ‘</a>’; else : echo ‘Hello <a href=”your_url”>’ . $c_user->display_name . ‘</a>, ‘; echo ‘ <a href=”‘ . … Read more

Placeholder text for ajax loaded conditional fields in the registration form

Yes you can add placeholder value after the AJAX is completed and is showing some conditional field. You can write these code in your custom.js file. jQuery(document).ajaxComplete(function(){ jQuery(‘#user_login’).attr(‘placeholder’, ‘User Name’); jQuery(‘#user_email’).attr(‘placeholder’, ‘User Email’); jQuery(‘#user_pass’).attr(‘placeholder’, ‘User Password’); }); You can mention the field id and then mention the placeholder text. Basically these set of code will … Read more