为优化destoon的注册优化体验,邮箱必填项可以进行忽略,毕竟现在用邮箱的少了,用手机的多了,可以参考以下教程来进行修改,省略掉邮箱的必填项,以节省会员注册时间,进行会员注册流程优化:
首先要修改数据库中的DT_member表中的email字段,因为之前的是:
UNIQUE KEY `email` (`email`)
因为这样所以插入数据库中的时候邮件就必须不能重复
我们需要把改下数据表的属性,用以下语句进行修改:
ALTER TABLE DT_member DROP INDEX email;
这样就取消了索引键
然后我们要去代码中进行修改:
modele/member/member.class.php 修改如下:
找到以下代码:
function is_email($email) {
global $MOD, $L;
$email = tri($email);
if(!is_email($email)) return $this->_($L['member_email_null']);
if($MOD['banemail']) {
$domain = subst(strstr($email, '@'), 1);
$tmp = explode('|', $MOD['banemail']);
foreach($tmp as $v) {
if($domain == $v) return $this->_($L['member_email_ban']);
}
}
return true;
}
function is_email($email) {
global $MOD, $L;
$email = tri($email);
if(!is_email($email)) return $this->_($L['member_email_null']);
if($MOD['banemail']) {
$domain = subst(strstr($email, '@'), 1);
$tmp = explode('|', $MOD['banemail']);
foreach($tmp as $v) {
if($domain == $v) return $this->_($L['member_email_ban']);
}
}
return true;
}
修改为下面代码:
function is_email($email) {
global $MOD, $L;
$email = tri($email);
if(!is_email($email)) return true;
if($MOD['banemail']) {
$domain = subst(strstr($email, '@'), 1);
$tmp = explode('|', $MOD['banemail']);
foreach($tmp as $v) {
if($domain == $v) return true;
}
}
return true;
}
global $MOD, $L;
$email = tri($email);
if(!is_email($email)) return true;
if($MOD['banemail']) {
$domain = subst(strstr($email, '@'), 1);
$tmp = explode('|', $MOD['banemail']);
foreach($tmp as $v) {
if($domain == $v) return true;
}
}
return true;
}
然后找到函数function is_member($member)
注释以下代码:
if(!$this->is_email(tri($member['email']))) return false;
if($this->email_exists(tri($member['email']))) return $this->_($L['member_email_reg']);
if($this->email_exists(tri($member['email']))) return $this->_($L['member_email_reg']);
找到函数function set_member($member) {
注释以下代码:
$member['mail'] = isset($member['mail']) ? tri($member['mail']) : '';
is_email($member['mail']) or $member['mail'] = '';
is_email($member['msn']) or $member['msn'] = '';
is_email($member['mail']) or $member['mail'] = '';
is_email($member['msn']) or $member['msn'] = '';
再找到module/member/admin/template/member_add.tpl.php文件
将以下代码
将以下代码
<input type="text" size="30" name="member[email]" id="email"validator('email');"/>
修改为:
<input type="text" size="30" name="member[email]" id="email" />
然后找到<script>
将以下代码注释:
if(Dd('email').value == '') {
Dmsg('请填写电子邮箱', 'email');
return false;
}
Dmsg('请填写电子邮箱', 'email');
return false;
}
找到module/member/admin/template/member_edit.tpl.php文件
将以下代码:
将以下代码:
<input type="text" size="30" name="member[email]" id="email" value="<?php echo $email;?>"validator('email');"/>
修改为:
<input type="text" size="30" name="member[email]" id="email" value="<?php echo $email;?>" />
找到<script>注释以下代码:
if(Dd('email').value == '') {
Dmsg('请填写电子邮箱', 'email');
return false;
}
希望以上教程能够帮助到使用destoon程序的朋友们!