wordpress

Link to WordPress by e-mail instead of username

By default WordPress uses a unique χρήστη για κάθε χρήστη που είναι εγγεγραμμένος στην . Wordpress

This name is used whenever a user wishes to enter the page, making it very easy for hackers to have half the chances of success in a brute force attack if they know the name.

The following publication describes how to change the default WordPress setting so that users of your website link using their e-mail instead of the username.

To do this we will use the wp_authenticate action that runs from WorPress to authenticate the user. You should be aware that every software update from WorPress should take the same steps as described below.

Essentially we will change the $username value (which is the username that the form displays s). So we can add the user's e-mail.

Use the following code

function email_login ($ username) {$ user = get_user_by_email ($ username); if (! empty ($ user-> user_login)) // if the email exists for a user return $ username = $ user-> user_login; // user_login or else the same string is return $ username; // returned for verification} add_action ('wp_authenticate', 'email_login');

It is important to know that this function works differently from other WordPress functions by sending the parameters as a reference point. Which means this function will be better suited to the kernel as a filter. This requires you to get the parameters, and change prices and return them.

So if the above code doesn't work check the /wp-includes/user.php file at 54 and you will see the code

do_action_ref_array ('wp_authenticate', array (& $ credentials ['user_login'], & $ credentials ['user_password']));

Normally, the functions use the function

do_action ()

but the particular uses the function

do_action_ref_array ()

and passes through the reference values.

If it does not work for you, change the function type to

do_action ()

iGuRu.gr The Best Technology Site in Greecefgns

every publication, directly to your inbox

Join the 2.087 registrants.

Written by giorgos

George still wonders what he's doing here ...

Leave a reply

Your email address is not published. Required fields are mentioned with *

Your message will not be published if:
1. Contains insulting, defamatory, racist, offensive or inappropriate comments.
2. Causes harm to minors.
3. It interferes with the privacy and individual and social rights of other users.
4. Advertises products or services or websites.
5. Contains personal information (address, phone, etc.).