Enable Wordpress to display the password directly without sending an email at registration.

Source: Internet
Author: User
Tags setcookie

From:

Http://www.v2op.com/blog/2008/08/wordpress%E6%B3%A8%E5%86%8C%E7%9B%B4%E6%8E%A5%E6%98%BE%E7%A4%BA%E5%AF%86%E7%A0%81/

 

The user registration mechanism of WordPress is to enter the user name and email address. WordPress generates a random password and sends it to the email address entered during user registration. However, many people do not configure the mail service (such as the server I am using) on their servers, or because of the anti-spam function of the mail service provider, as a result, the password email sent by WordPress cannot be received after registration, and registration cannot be completed.

Inconvenient...

In this case, it is better to hacks WordPress. So that no email is sent during WordPress registration, and the password is displayed directly.
How to change it? Very simple, just change the wp-login.php under the WordPress root directory.

1. Search for the following sentence in the register_new_user function. Used to send notifications after successful registration. Comment it out.
wp_new_user_notification($user_id, $user_pass);

2. Add two sentences in the next line of the above sentence:
setcookie("u", $user_login);
setcookie("user_pass", $user_pass);

The purpose is to write the username entered during registration and the password randomly generated by WordPress into cookies so that they can be called later.

3. Search for the following sentence
$errors->add('registered', __('Registration complete. Please check your e-mail.'), 'message');

And replace it

$ Errors-> Add ('registered', _ ('^__^ registered successfully! User name :'. $ _ cookie ["U"]. 'password :'. $ _ cookie ["user_pass"]. '(you can change the password to a password that is easy to remember after logon)'), 'message ');

At this point, the modification is complete. Save and upload.

Note: This article is based on WordPress 2.6.1. I didn't see any other versions, so there should be no major changes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.