始创于2000年 股票代码:831685
咨询热线:0371-60135900 注册有礼 登录
  • 挂牌上市企业
  • 60秒人工响应
  • 99.99%连通率
  • 7*24h人工
  • 故障100倍补偿
您的位置: 网站首页 > 帮助中心>文章内容

有关UCenter修改用户名无效的问题

发布时间:  2012/8/28 19:22:58

有些站长在UCenter修改用户名后,Discuz! 并没有显示出来效果,造成无效的原因主要是通信问题, 如果你的站点显示通信成功且配置文件和UCenter应用管理当中的一致,则在UCenter修改用户信息后,会自动通知Discuz!修改相关用户信息 的,如果修改之前,通信失败,修复通信后,可以到UCenter的通知列表里,点击发送通知,一样会修改Discuz! 的用户信息的。在UCenter里执行修改用户信息时,调用onedit函数
 

01 function onedit() {  
02           $uid = getgpc('uid');  
03           $status = 0;  
04           if(!$this->user['isfounder']) {    //判断是否受保护用户  
05                    $isprotected = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."protectedmembers WHERE uid = '$uid'");  
06                    if($isprotected) {  
07                              $this->message('user_edit_noperm');  
08                    }  
09           }  
10    
11           if($this->submitcheck()) {    //判断是否提交更新  
12                    $username = getgpc('username', 'P');  
13                    $newusername = getgpc('newusername', 'P');  
14                    $password = getgpc('password', 'P');  
15                    $email = getgpc('email', 'P');  
16                    $delavatar = getgpc('delavatar', 'P');  
17                    $rmrecques = getgpc('rmrecques', 'P');  
18                    $sqladd = '';  
19                    if($username != $newusername) {    //是否更新用户名  
20                              if($_ENV['user']->get_user_by_username($newusername)) {  
21                                       $this->message('admin_user_exists');  
22                              }  
23                              $sqladd .= "username='$newusername', ";  
24                              $this->load('note');  
25                              $_ENV['note']->add('renameuser', 'uid='.$uid.'&oldusername='.urlencode($username).'&newusername='.
26 urlencode($newusername));//保存记录  
27                    }  
28                    if($password) {    //密码是否更新  
29                              $salt = substr(uniqid(rand()), 0, 6);  
30                              $orgpassword = $password
function onedit() {  
02           $uid = getgpc('uid');  
03           $status = 0;  
04           if(!$this->user['isfounder']) {    //判断是否受保护用户  
05                    $isprotected = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."protectedmembers WHERE uid = '$uid'");  
06                    if($isprotected) {  
07                              $this->message('user_edit_noperm');  
08                    }  
09           }  
10    
11           if($this->submitcheck()) {    //判断是否提交更新  
12                    $username = getgpc('username', 'P');  
13                    $newusername = getgpc('newusername', 'P');  
14                    $password = getgpc('password', 'P');  
15                    $email = getgpc('email', 'P');  
16                    $delavatar = getgpc('delavatar', 'P');  
17                    $rmrecques = getgpc('rmrecques', 'P');  
18                    $sqladd = '';  
19                    if($username != $newusername) {    //是否更新用户名  
20                              if($_ENV['user']->get_user_by_username($newusername)) {  
21                                       $this->message('admin_user_exists');  
22                              }  
23                              $sqladd .= "username='$newusername', ";  
24                              $this->load('note');  
25                              $_ENV['note']->add('renameuser', 'uid='.$uid.'&oldusername='.urlencode($username).'&newusername='.
26 urlencode($newusername));//保存记录  
27                    }  
28                    if($password) {    //密码是否更新  
29                              $salt = substr(uniqid(rand()), 0, 6);  
30                              $orgpassword = $password;  
31                              $password = md5(md5($password).$salt);  
32                              $sqladd .= "password='$password', salt='$salt', ";  
33                              $this->load('note');  
34                              $_ENV['note']->add('updatepw', 'username='.urlencode($username).'&password=');//保存记录  
35                    }  
36                    if($rmrecques) {   //验证问答  
37                              $sqladd .= "secques='', ";  
38                    }  
39                    if(!empty($delavatar)) {    //删除头像  
40                              $_ENV['user']->delete_useravatar($uid);  
41                    }  
42    
43                    $this->db->query("UPDATE ".UC_DBTABLEPRE."members SET $sqladd email='$email' WHERE uid='$uid'");  
44                    $status = $this->db->errno() ? -1 : 1;  
45           }                  
46           $user = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."members WHERE uid='$uid'");  
47           $user['bigavatar'] = '<img src="avatar.php?uid='.$uid.'&size=big">';  
48           $user['bigavatarreal'] = '<img src="avatar.php?uid='.$uid.'&size=big&type=real">';  
49           $this->view->assign('uid', $uid);  
50           $this->view->assign('user', $user);  
51           $this->view->assign('status', $status);  
52           $this->view->display('admin_user');  
53 }

有些站长在UCenter修改用户名后,Discuz! 并没有显示出来效果,造成无效的原因主要是通信问题, 如果你的站点显示通信成功且配置文件和UCenter应用管理当中的一致,则在UCenter修改用户信息后,会自动通知Discuz!修改相关用户信息 的,如果修改之前,通信失败,修复通信后,可以到UCenter的通知列表里,点击发送通知,一样会修改Discuz! 的用户信息的。在UCenter里执行修改用户信息时,调用onedit函数
 

01 function onedit() {  
02           $uid = getgpc('uid');  
03           $status = 0;  
04           if(!$this->user['isfounder']) {    //判断是否受保护用户  
05                    $isprotected = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."protectedmembers WHERE uid = '$uid'");  
06                    if($isprotected) {  
07                              $this->message('user_edit_noperm');  
08                    }  
09           }  
10    
11           if($this->submitcheck()) {    //判断是否提交更新  
12                    $username = getgpc('username', 'P');  
13                    $newusername = getgpc('newusername', 'P');  
14                    $password = getgpc('password', 'P');  
15                    $email = getgpc('email', 'P');  
16                    $delavatar = getgpc('delavatar', 'P');  
17                    $rmrecques = getgpc('rmrecques', 'P');  
18                    $sqladd = '';  
19                    if($username != $newusername) {    //是否更新用户名  
20                              if($_ENV['user']->get_user_by_username($newusername)) {  
21                                       $this->message('admin_user_exists');  
22                              }  
23                              $sqladd .= "username='$newusername', ";  
24                              $this->load('note');  
25                              $_ENV['note']->add('renameuser', 'uid='.$uid.'&oldusername='.urlencode($username).'&newusername='.
26 urlencode($newusername));//保存记录  
27                    }  
28                    if($password) {    //密码是否更新  
29                              $salt = substr(uniqid(rand()), 0, 6);  
30                              $orgpassword = $password;  
31                              $password = md5(md5($password).$salt);  
32                              $sqladd .= "password='$password', salt='$salt', ";  
33                              $this->load('note');  
34                              $_ENV['note']->add('updatepw', 'username='.urlencode($username).'&password=');//保存记录  
35                    }  
36                    if($rmrecques) {   //验证问答  
37                              $sqladd .= "secques='', ";  
38                    }  
39                    if(!empty($delavatar)) {    //删除头像  
40                              $_ENV['user']->delete_useravatar($uid);  
41                    }  
42    
43                    $this->db->query("UPDATE ".UC_DBTABLEPRE."members SET $sqladd email='$email' WHERE uid='$uid'");  
44                    $status = $this->db->errno() ? -1 : 1;  
45           }                  
46           $user = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."members WHERE uid='$uid'");  
47           $user['bigavatar'] = '<img src="avatar.php?uid='.$uid.'&size=big">';  
48           $user['bigavatarreal'] = '<img src="avatar.php?uid='.$uid.'&size=big&type=real">';  
49           $this->view->assign('uid', $uid);  
50           $this->view->assign('user', $user);  
51           $this->view->assign('status', $status);  
52           $this->view->display('admin_user');  
53 }
这个函数首先判断是该用户受保护,然后就是判断是否提交了修改,当提交后,判断用户名是否修改,密码是否做了修改,验证问题及头像等是否修改,如果做了修 改,调用add()方法在notelist表保存更新内容,当修改成功后,二次调用send方法时,会自动向各个UCenter应用发出执行命令,更新对 应用户的信息,并保存通知,如果不成功,提示通知失败,并指向链接,手动通知。
本文出自:亿恩科技【www.enkj.com】

服务器租用/服务器托管中国五强!虚拟主机域名注册顶级提供商!15年品质保障!--亿恩科技[ENKJ.COM]

  • 您可能在找
  • 亿恩北京公司:
  • 经营性ICP/ISP证:京B2-20150015
  • 亿恩郑州公司:
  • 经营性ICP/ISP/IDC证:豫B1.B2-20060070
  • 亿恩南昌公司:
  • 经营性ICP/ISP证:赣B2-20080012
  • 服务器/云主机 24小时售后服务电话:0371-60135900
  • 虚拟主机/智能建站 24小时售后服务电话:0371-60135900
  • 专注服务器托管17年
    扫扫关注-微信公众号
    0371-60135900
    Copyright© 1999-2019 ENKJ All Rights Reserved 亿恩科技 版权所有  地址:郑州市高新区翠竹街1号总部企业基地亿恩大厦  法律顾问:河南亚太人律师事务所郝建锋、杜慧月律师   京公网安备41019702002023号
      1
     
     
     
     

    0371-60135900
    7*24小时客服服务热线