分享

[功能修改] Discuzx3.4版本如何取消注册邮箱必填,并删除显示教程

[复制链接]

Discuzx3.4版本如何取消注册邮箱必填,并删除显示教程

发表于 2021-5-7 15:28:35 来自 功能修改 阅读模式 倒序浏览
1303 2 查看全部
x3.4版本如何取消注册邮箱必填,并删除显示教程
输入简体字,点下面繁体字按钮进行在线大家好
今天有看到有站长想去掉注册时邮箱必填
x3.0 和 x3.1 版本时后台可以设置的
但 x3.2 版本后台又取消这个功能设置了
刚才有空时整理了一下

打开
source/admincp/admincp_setting.php 文件
查找转换


showsetting('setting_access_register_send_register_url', 'settingnew[sendregisterurl]', $setting['sendregisterurl'], 'radio');


在这段代码下方添加


showsetting('setting_access_register_forge_email', 'settingnew[forgeemail]', $setting['forgeemail'], 'radio');


再打开
source/language/lang_admincp.php 文件
查找


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


在这段代码下方添加


'setting_access_register_forge_email' => '取消注册邮箱必填',         'setting_access_register_forge_email_comment' => '开启后如果用户不填写注册邮箱,将自动生成一个随机邮箱地址',


再打开
source/class/class_member.php 文件
查找


$email = strtolower(trim($_GET['email']));                                 if(empty($this->setting['ignorepassword'])) {                                         if($_GET['password'] !== $_GET['password2']) {                                                 showmessage('profile_passwd_notmatch');                                         }                                          if(!$_GET['password'] || $_GET['password'] != addslashes($_GET['password'])) {                                                 showmessage('profile_passwd_illegal');                                         }                                         $password = $_GET['password'];                                 } else {                                         $password = md5(random(10));                                 }                         }


替换为


$email = strtolower(trim($_GET['email']));                                 if(empty($email) && $_G['setting']['forgeemail']) {                                         $_GET['email'] = $email = strtolower(random(6)).'@'.$_SERVER['HTTP_HOST'];                                 }                                 if(empty($this->setting['ignorepassword'])) {                                         if($_GET['password'] !== $_GET['password2']) {                                                 showmessage('profile_passwd_notmatch');                                         }                                          if(!$_GET['password'] || $_GET['password'] != addslashes($_GET['password'])) {                                                 showmessage('profile_passwd_illegal');                                         }                                         $password = $_GET['password'];                                 } else {                                         $password = md5(random(10));                                 }                         }


修改前请先备份
修改后记得更新缓存


回复

使用道具 举报

yyb 发表于 2021-5-24 02:12:03 显示全部楼层
试了无效,还是没变的
回复

使用道具 举报

luneng 发表于 2023-2-22 13:06:55 显示全部楼层
X 3.5 试了无效
回复

使用道具 举报

游客~
懒得打字嘛,点击右侧快捷回复
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋| 鲸云论坛

© 2013-2016 Comsenz Inc. Powered by Discuz! X3.4