This article mainly introduces about WordPress in the registration interface to achieve registration password directly displayed on the page, has a certain reference value, now share to everyone, the need for friends can refer to
Objective:
WordPress function is undoubtedly powerful, but some of the features are still a little unsatisfactory, such as the site has a new user registration, must be issued to the user to fill in the mail to receive the new password, and the password is automatically generated by the system, if for some reason the user can not receive mail, resulting in the phenomenon of unable to log in, This kind of user experience is still a bit bad. So you can prompt for the generated password after registering with the new user so that the user can log in directly without waiting for the message to log in.
Do something before you start the change:
WordPress By default is not allowed to register the user, so you need to log in to the background open registration function first.
here is the implementation process:
First, you need to find these two files. wp-login.php, user.php (/wp-includes/user.php)
1. Locate this line of code under Wp-includes/user.php–>function Register_new_user () {}:
1 update_user_option ($user _id, ' Default_password_nag ', true, true); Set up the Password change nag.
Add the sentence below it
1 //write the registered user name and randomly generated password into cookie2 setcookie ("U", $user _login), 3 Setcookie ("User_pass", $user _pass);
(Note: The current WordPress 4.7.3 version is under the/wp-includes/user.php path)
2. Locate this file in the WordPress root directory wp-login.php
and find this code.
1 $errors->add (' Registered ', __ (' registration complete. Please check your email. '), ' message ');
Then replace it with the following code:
1//Read the username and password written into the cookie after registering 2 $errors->add (' Registered ', __ (' registered successfully! User name: '. $_cookie["U"]. ' Password: '. $_cookie["User_pass"]. ' (after logging in to make it easy for you to remember the password), ' message ');
Well, this will enable registration and display the newly registered user name and password on the interface.
The effect is as follows
The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!