Redirect to “Thank you” page after register new user on custom register form

OK, so it’s clear that the redirection won’t work in this case. You can’t output any HTML before sending headers, and redirection sends a header. The easiest (but bad) solution is to move you PHP code to the top of that page template: <?php /* Template Name: Register Page */ $err=””; $success=””; global $wpdb, $PasswordHash, … Read more

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)