test Blog
Happy living

[转]让WordPress注册时不发邮件,直接显示密码

老鼠 posted @ 2009年3月04日 00:54 in web with tags Wordpress 注册 密码 , 2675 阅读

WordPress的用户注册机制是,填写用户名、邮箱,由WordPress生成随机密码,并发送到用户注册时填写的邮箱地址。但很多人的服务器并没有配置邮件服务(比如我正在用的这台服务器),或者由于邮件运行商的反垃圾邮件功能等原因,导致注册之后收不到WordPress发送的密码邮件,无法完成注册。

很不方便…

既然如此,不如我们hacks一下wordpress。让WordPress注册时不发邮件,直接显示密码得了。
怎么改呢?很简单,只需改动WordPress根目录下的 wp-login.php 即可。

1、搜索下面这句,位于 register_new_user 函数中。用于注册成功后发送通知。找到后把它注释掉。
wp_new_user_notification($user_id, $user_pass);

2、并在上面这句的下一行加上两句:
setcookie("u", $user_login);
setcookie("user_pass", $user_pass);

目的是把注册时填写的用户名,以及wordpress随机生成的密码写入cookies,以便在后面调用。

3、搜索下面这句
$errors->add('registered', __('Registration complete. Please check your e-mail.'), 'message');

并把它替换为

$errors->add('registered', __(' ^__^ 注册成功!

用户名:’.$_COOKIE[“u”].’
密码:’.$_COOKIE["user_pass"].’
(登录后自行修改成您便于记忆的密码)’), ‘message’);

到此,就修改完成了。保存,上传。

注:本文基于 WordPress 2.6.1。其它版本的没看,应该没啥大的变化。

how to delete an ins 说:
2022年8月08日 16:05

Completely deleting your Instagram Account will get all your activity connection and activities through this account to be removed permanently, and also Comments, Likes, photos, Videos and your follower will be completely removed from the Instagram Account. how to delete an instagram account This process of deleting an Instagram Account is nowhere a recoverable process, thus if you want to get an account removed you may need to think twice and confirm, and make sure you have got the password for the Instagram Account that you want to delete from your MAC or Android, else you won’t be able to proceed further.

Punjab Board 12th Im 说:
2022年8月18日 20:33

In accordance with a Punjabi state law, the Punjab School Education Board PSEB, Chandigarh, was established in 1969 to oversee the instruction provided in the state's public schools. It will provide tests to every student enrolled in the appropriate subjects. Every year, it will inform the students about the Previous Exam Questions for PSEB Class 12th 2023. Punjab Board 12th Important Question Paper 2023 The PSEB 12th Exam New Model Paper 2023, PSEB 12th Exam Guess Paper 2023, and PSEB 12th Sample Question Paper 2023 for Class XII have all been made public by the Board, as they are every year. The tests will take place in February and March of 2023.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter