Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[已解决] 【分享】後台添加取消註冊郵箱必填功能 (x3.2 版本 繁和簡)

[复制链接]
dicky57 发表于 2014-8-5 22:08:17 | 显示全部楼层 |阅读模式
本帖最后由 dicky57 于 2014-8-6 14:36 编辑

大家好
今天有看到有站長想去掉註冊時郵箱必填
x3.0 和 x3.1 版本時後台可以設置的

但 x3.2 版本後台又取消這個功能設置了
剛才有空時整理了一下
分享給有需要的站長們

另外樓主樓層第二頁
提供簡體版本方便其他站長閱讀^^


打開

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');
复制代码


再打開

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' => '開啟後如果用戶不填寫註冊郵箱,將自動生成一個隨機郵箱地址',
复制代码


再打開

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.                         }
复制代码


修改前請先備份
修改後記得更新緩存

修改前



修改後



註冊時就可以不用填寫 E-mail





本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
☆嗜血Ⅷ风云 发表于 2014-8-6 11:09:53 | 显示全部楼层
赞一个~\(≧▽≦)/~
回复

使用道具 举报

KiSsゞ 发表于 2014-8-6 13:13:28 | 显示全部楼层
邮箱必填其实是方便找回密码的哦
回复

使用道具 举报

 楼主| dicky57 发表于 2014-8-6 14:45:40 | 显示全部楼层

嗯~
謝謝您的支持喔^^
回复

使用道具 举报

 楼主| dicky57 发表于 2014-8-6 14:48:38 | 显示全部楼层
KiSsゞ 发表于 2014-8-6 13:13
邮箱必填其实是方便找回密码的哦

嗯~
對啊

其實 e-mail 是必須的
但有些站長他們就會有一些特別的需求

他們好像是考慮到有的會員不知道什麼是 e-mail
還有就是不知道怎麼填寫 e-mail
或是怕麻煩等等問題

所以想要去掉這個功能
但就像您說的當忘記密碼時
e-mail 就可以發揮功能了

其實我也是不建議去掉這個功能

不過這個功能我覺得蠻不錯的
就是它可以讓您自由選擇

也許您現在不想要 e-mail
但後來您發現 e-mail 的重要性時
可以在後台設置回來

所以就分享了這個方法
方便有需要的站長們自由選擇^^
回复

使用道具 举报

伴友@ 发表于 2014-8-6 16:05:11 | 显示全部楼层
好像之前有个人发表过这个教程的帖子
回复

使用道具 举报

 楼主| dicky57 发表于 2014-8-6 17:31:25 | 显示全部楼层
伴友@ 发表于 2014-8-6 16:05
好像之前有个人发表过这个教程的帖子

嗯~
剛才搜索了一下
之前有站長分享過了^^

不過他的主題已經看不到內容了

https://discuz.dismall.com/thread-3587341-1-20.html
回复

使用道具 举报

李玉郎 发表于 2014-10-18 18:50:12 | 显示全部楼层
谢谢楼主。完美解决!
回复

使用道具 举报

milian2008 发表于 2021-3-17 15:20:55 | 显示全部楼层
3.4不好使了。。。去了必填项,但注册时还是会提示邮箱错误
回复

使用道具 举报

科站网 发表于 2021-3-17 15:24:16 | 显示全部楼层
milian2008 发表于 2021-3-17 15:20
3.4不好使了。。。去了必填项,但注册时还是会提示邮箱错误

https://addon.dismall.com/plugins/tshuz_removeemail.html
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-5-5 09:19 , Processed in 0.105145 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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