I want to login in wordpress with username , email id and phone number.
where I am inserting phone number in User meta at the time of User registration.
Is there any hook where I can access user meta and validate it with password for login.
https://wordpress.org/plugins/wp-email-login/
I came to know that this plugin is used for username and email id validation at the login time. So, I can login with username and email id but my main issue was phone nmber which is in user meta table.
4 comments
Comments are closed.
Try this one :
The first thing we need to do is remove the default authentication rights. Add the following snippet to your functions.php file:
Next, weâre going to add our own authentication. To do so, weâre going to use add_filter.
Add the following code to your functions.php files:
Form this time should be :
Ofcourse if you want one input field for all then it can be done. But you need to decide how will you choose which validation to be performed phonenumber , email address or Username
you can use this plugin to login and register with phone number or email and password.
the code will be send to you with sms or email and you can authenticate with that. and your customer can set password for him/her , so it does not need to send activation code via sms or email again.
https://wordpress.org/plugins/login-with-phone-number/
You need to create a template at front end to be displayed like this :
Above that write this php code which will work on form
I am getting the User ID of the user by its username and then getting User Phone in the user_meta table by User ID and then matching it with submitted user phone number.
I have assumed the meta_key and input type name both as “user_phone”
Assuming you store the phone number in
user_phone
meta field. You can use the below code that I use in one of my plugins “Actions Pack” which provides user registration and login facility for Elementor page builder.Here is a phone number validity check function. It depends on how you receive your phone number. Is it with country calling code or not.