ecshop 注册时邮箱可填可不填,选填
注册时,邮箱可选可不选,如果填写了该项,会有邮箱格式验证,是否重复等,不填写则什么都没有.
第1,打开 /themes/default/user_passport.dwt 文件,找到:
id="username_notice" style="color:#FF0000">*
修改为:
id="username_notice" style="color:#FF0000">
第2,打开 /js/user.js文件,找到下面js代码并删除掉.
1).查找 function checkEmail(email),将整个函数替换为:
- function checkEmail(email)
- {
- if (email != '')
- {
- var submit_disabled = false;
- if (!Utils.isEmail(email))
- {
- document.getElementByIdx_x_x_x('email_notice').innerHTML = msg_email_format;
- submit_disabled = true;
- }
-
- if( submit_disabled )
- {
- document.forms['formUser'].elements['Submit'].disabled = 'disabled';
- return false;
- }
- Ajax.call( 'user.php?act=check_email', 'email=' + email, check_email_callback , 'GET', 'TEXT', true, true );
- }
- }
2).查找一下代码,并删除:
- if (email.length == 0)
- {
- msg += email_empty + ‘\n’;
- }
- else
- {
- if ( ! (Utils.isEmail(email)))
- {
- msg += email_invalid + ‘\n’;
- }
- }
第3.打开/includes/lib_passport.php 文件找到下面的代码:
- if (emptyempty($email))
- {
- $GLOBALS['err']->add($GLOBALS['_LANG']['email_empty']);
- }
- else
- {
- if (!is_email($email))
- {
- $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['email_invalid'], htmlspecialchars($email)));
- }
- }
-
-
- if (!emptyempty($email))
- {
- if (!is_email($email))
- {
- $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['email_invalid'], htmlspecialchars($email)));
- }
- }
4.最后打开includes/modules/integrates/integrate.php 文件,找到:
- $sql = “SELECT ” . $this->field_id .
- ” FROM ” . $this->table($this->user_table).
- ” WHERE ” . $this->field_email . ” = ‘$email’”;
- if ($this->db->getOne($sql, true) > 0)
- {
- $this->error = ERR_EMAIL_EXISTS;
- return false;
- }
-
- if(!emptyempty($email)){
-
- $sql = "SELECT " . $this->field_id .
- " FROM " . $this->table($this->user_table).
- " WHERE " . $this->field_email . " = '$email'";
- if ($this->db->getOne($sql, true) > 0)
- {
- $this->error = ERR_EMAIL_EXISTS;
-
- return false;
- }
- }
-