Plugin Author
xootix
(@xootix)
You need to register customer first using plugin’s mobile number field.
Not any mobile number stored on your website can be used for login
Thanks for your reply. Can I not re-populate the plugins phone number field with the user phone number? I have a large user base which may take some time.
Plugin Author
xootix
(@xootix)
Yes, its possible.
Saving numbers for login is more complicated than simply saving them in a field.
For login purpose, we need to check whether the number is already used before or not, plus there is a possibility of two same phone numbers with different country code.
I can share the snippet to merge phone number fields. Are you using woocommerce?
Where are the numbers stored? It should be in WC’s billing phone field.
Hi, yes I am using Woocom and yes to WC’s billing phone.
Will this merge cause any issues if the plug-in was disabled?
Plugin Author
xootix
(@xootix)
No, merging will simply copy your WC’s billing phone field to plugin’s phone field.
It is not going to affect your site in anyway even if you abort or re run the code.
Completely safe.
(Goes in functions.php)
1) Change +91 below to your country code if not India
2) Visit http://www.yourwebsite.com/wp-admin/admin.php?page=xoo-ml, the code will run & it may take few seconds to load page.
Once the page is loaded, you can remove the code.
add_action( 'init', function(){
if( !is_admin() || wp_doing_ajax() || !isset( $_GET['page'] ) || $_GET['page'] !== 'xoo-ml' ) return; // run only on otp settings page
$args = array(
'role' => 'customer',
);
$users = get_users( $args );
$phone_code = '+91';
//loop users
foreach ( $users as $user ) {
$billing_phone = get_user_meta( $user->ID, 'billing_phone', true ); //Get billing phone
if( !$billing_phone ) continue; // switch to next user if billing phone is empty
update_user_meta( $user->ID, 'xoo_ml_phone_code', $phone_code ); //Update phone code required for login
update_user_meta( $user->ID, 'xoo_ml_phone_no', $billing_phone ); //Update phone number required for login
update_user_meta( $user->ID, 'xoo_ml_phone_display', $phone_code.$billing_phone ); // Just for display
}
} );
-
This reply was modified 2 years, 8 months ago by xootix.
-
This reply was modified 2 years, 8 months ago by xootix. Reason: Code updated
Thanks, I am editing from Theme Editor and adding your code to functions.php with the following error:
syntax error, unexpected end of file
Plugin Author
xootix
(@xootix)
Please copy the code again, I updated it few minutes later after posting.
Great thanks. I now have the error:
This page isn’t working http://www.websiteremoved.com redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS
I’ve now resolved the error. thank you!
I now get “TOO LONG” error when registering a tel number in my account? I have taken away to 0 for a mobile as it’s UK. I have added 44 and still the error?
I will start a new thread
Does Firebase require Firebase’s reCAPTCHA verifier as per it’s documentation in order for it to work and does the app contain this data for it to work?
I am getting invalid OTP – What could this be?
“Before you can sign in users with their phone numbers, you must set up Firebase’s reCAPTCHA verifier. Firebase uses reCAPTCHA to prevent abuse, such as by ensuring that the phone number verification request comes from one of your app’s allowed domains.”
Found the issue – it seems that the phone number has to have the first zero removed (UK) and so if the user doesn’t have the zero removed, the error “invalid otp” will show. This means some kind of cod editing will need to be done as most UK users will input the zero and the fact that there is no validation to ensure the user doesn’t enter a zero or to remove the zero when entered from what I can see.