给ecshop后台添加通过email搜索用户的功能,最模板介绍如下:
先找到ecshop下两个文件admin/users.php以及admin/templates/users_list.htm
1,修改admin/users.php:
查找“过滤条件”,672行左右,在$filter['keywords']后一行添加
$filter['email'] = empty($_REQUEST['email']) ? '' : trim($_REQUEST['email']);
查找
if ($filter['keywords'])
{
$ex_where .= " AND user_name LIKE '%" . mysql_like_quote($filter['keywords']) ."%'";
}
修改为:
if ($filter['keywords'] && $filter['email'])
{
$ex_where .= " AND user_name LIKE '%" . mysql_like_quote($filter['keywords']) ."%' AND email LIKE '%" . mysql_like_quote($filter['email']) ."%'";
}
elseif($filter['keywords'])
{
$ex_where .= " AND user_name LIKE '%" . mysql_like_quote($filter['keywords']) ."%'";
}
elseif($filter['email'])
{
$ex_where .= " AND email LIKE '%" . mysql_like_quote($filter['email']) ."%'";
}
2,修改admin/templates/users_list.htm
查找 {$lang.label_user_name},11行左右,在下面添加
邮箱地址
查找listTable.filter['rank'],97行左右,在后面添加:
listTable.filter['email'] = document.forms['searchForm'].elements['email'].value;
至此就可以在用户列表里面通过邮箱查找用户了。