找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 45|回复: 0

[DZ教程] Discuz X3.2-3.4关闭注册邮箱必填选项

[复制链接] 认领更换作者

[DZ教程] Discuz X3.2-3.4关闭注册邮箱必填选项

[复制链接] 认领更换作者
晴天

主题

0

回帖

1174

积分

指导员

经验
T豆
听众
注册时间
2021-2-2
2023-2-3 14:32:42 | 显示全部楼层 |阅读模式
1、第一步:source/admincp/admincp_setting.php 文件 查找

  1. showsetting('setting_access_register_send_register_url', 'settingnew[sendregisterurl]', $setting['sendregisterurl'], 'radio');
复制代码

在这个代码下添加:

  1. showsetting('setting_access_register_forge_email', 'settingnew[forgeemail]', $setting['forgeemail'], 'radio');
复制代码


2、第二步 打開 source/language/lang_admincp.php 文件
查找:

  1. 一个邮箱只允许注册一个用户<br/>注意:只有在<a href="?action=setting&operation=mail">站长 - 邮件设置</a>中完成邮件设置,确保邮件能送成功下可以开启该功能 ',
复制代码

在下面添加:

  1. 'setting_access_register_forge_email' => '取消注册邮箱必填',

  2. 'setting_access_register_forge_email_comment' => '开启后如果用不不填写注册邮箱,将自动生成一个邮箱地址',
复制代码


3、第三步:修改 source/class/class_member.php文件

  1. $email = strtolower(trim($_GET['email']));

  2. if(empty($this->setting['ignorepassword'])) {

  3. if($_GET['password'] !== $_GET['password2']) {

  4. showmessage('profile_passwd_notmatch');

  5. }

  6. if(!$_GET['password'] || $_GET['password'] != addslashes($_GET['password'])) {

  7. showmessage('profile_passwd_illegal');

  8. }

  9. $password = $_GET['password'];

  10. } else {

  11. $password = md5(random(10));

  12. }

  13. }
复制代码


修改为:

  1. $email = strtolower(trim($_GET['email']));

  2. if(empty($email) && $_G['setting']['forgeemail']) {

  3. $_GET['email'] = $email = strtolower(random(6)).'@'.$_SERVER['HTTP_HOST'];

  4. }

  5. if(empty($this->setting['ignorepassword'])) {

  6. if($_GET['password'] !== $_GET['password2']) {

  7. showmessage('profile_passwd_notmatch');

  8. }

  9. if(!$_GET['password'] || $_GET['password'] != addslashes($_GET['password'])) {

  10. showmessage('profile_passwd_illegal');

  11. }

  12. $password = $_GET['password'];

  13. } else {

  14. $password = md5(random(10));

  15. }

  16. }
复制代码


这样修改后,后台就会出现一个注册邮箱取消的功能。然后设置取消后,前台也会相应的变化了。


发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

小黑屋|QT论坛 | 鲁ICP备14016835号

GMT+8, 2023-3-27 14:57

Powered by QT论坛

Copyright © 2022-2023 qtpojie.

快速回复 返回顶部 返回列表