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

 找回密码
 立即注册
搜索

[求助] x3.0的版本,如何限制只能注册中文用户名

[复制链接]
chanlin 发表于 2013-6-2 12:30:55 | 显示全部楼层 |阅读模式
请教一下,x3.0的版本,如何限制只能注册中文用户名。之前修改X2.5的方式不行,找不到语句
回复

使用道具 举报

yz0752 发表于 2013-6-25 15:48:46 | 显示全部楼层
我也想知道
回复

使用道具 举报

柒瑞爱心天使 发表于 2013-6-25 18:26:57 | 显示全部楼层
柒瑞中文用户名 公益免费版

https://addon.dismall.com/?@cnreg_7ree.plugin

增强Discuz的功能,只允许纯中文名注册论坛。
特色1: PHP正则智能匹配算法,核心代码简洁高效;
特色2: 用户体验良好,(完成用户名输入移动鼠标时)非中文用户名实时监测提示;
特色3: 自动识别GBK及UTF8,适用不同语言版本;
特色4: 完全符合DISCUZ插件机制规范,绿色安装,系统文件无损;
特色5: DISCUZ!X2.0,X2.5l两个版本权限支持,应用范围更广。
特色6: 柒瑞出品 品质保证 可靠技术支持,值得信赖。
本应用的研发符合《Discuz!应用产品规范化研发流程》



回复

使用道具 举报

龙坤互联 发表于 2013-8-4 17:18:19 | 显示全部楼层
无需安装插件,完全绿色使用,可防止注册英文账号,需要的联系我:1196192935
回复

使用道具 举报

 楼主| chanlin 发表于 2013-9-21 19:01:12 | 显示全部楼层
柒瑞爱心天使 发表于 2013-6-25 18:26
柒瑞中文用户名 公益免费版

https://addon.dismall.com/?@cnreg_7ree.plugin

柒瑞的东西总是很给力,赞一个
回复

使用道具 举报

firesword 发表于 2014-5-29 11:33:42 | 显示全部楼层
限制只能中文注册用户名称:
1:修改uc_client\model\user.php
function check_username($username) {
  $guestexp = '\xA1\xA1|\xAC\xA3|^Guest|^\xD3\xCE\xBF\xCD|\xB9\x43\xAB\xC8';
  $len = $this->dstrlen($username);
  if($len > 15 || $len < 3 || !(preg_match("/^[\x{4e00}-\x{9fa5}]+$/u",$username)) || preg_match("/\s+|^c:\\con\\con|[%,\*\"\s\<\>\&]|$guestexp/is", $username)) {
   return FALSE;
  } else {
   return TRUE;
  }
}

2:修改source\language\lang_message.php
在229行左右加 一个错误消息
  'profile_username_tooshort' => '抱歉,您输入的用户名小于 3 个字符,请输入一个较长的用户名',
    'profile_username_notallchinese' => '抱歉,用户名必须全部是中文',
'profile_username_toolong' => '抱歉,您的用户名超过 15 个字符,请输入一个较短的用户名',

3:source\module\forum\forum_ajax.php
在20行左右加一个判断
if($usernamelen < 3) {
  showmessage('profile_username_tooshort', '', array(), array('handle' => false));
} elseif($usernamelen > 15) {
  showmessage('profile_username_toolong', '', array(), array('handle' => false));
}
  if(!(preg_match("/^[\x{4e00}-\x{9fa5}]+$/u",$username))) {
   showmessage('profile_username_notallchinese', '', array(), array('handle' => false));
}

4:
在581行左右加一个判断
if($usernamelen < 3) {
     showmessage('profile_username_tooshort');
    } elseif($usernamelen > 15) {
     showmessage('profile_username_toolong');
    }
    if(!(preg_match("/^[\x{4e00}-\x{9fa5}]+$/u",$username))) {
       showmessage('profile_username_notallchinese');
    }
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 01:51 , Processed in 0.107577 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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