有些站长在UCenter修改用户名后,Discuz! 并没有显示出来效果,造成无效的原因主要是通信问题, 如果你的站点显示通信成功且配置文件和UCenter应用管理当中的一致,则在UCenter修改用户信息后,会自动通知Discuz!修改相关用户信息 的,如果修改之前,通信失败,修复通信后,可以到UCenter的通知列表里,点击发送通知,一样会修改Discuz! 的用户信息的。在UCenter里执行修改用户信息时,调用onedit函数
04 |
if (! $this ->user[ 'isfounder' ]) { |
05 |
$isprotected = $this ->db->result_first( "SELECT COUNT(*) FROM " .UC_DBTABLEPRE. "protectedmembers WHERE uid = '$uid'" ); |
07 |
$this ->message( 'user_edit_noperm' ); |
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' ); |
19 |
if ( $username != $newusername ) { |
20 |
if ( $_ENV [ 'user' ]->get_user_by_username( $newusername )) { |
21 |
$this ->message( 'admin_user_exists' ); |
23 |
$sqladd .= "username='$newusername', " ; |
25 |
$_ENV [ 'note' ]->add( 'renameuser' , 'uid=' . $uid . '&oldusername=' .urlencode( $username ). '&newusername=' . |
26 |
urlencode( $newusername )); |
29 |
$salt = substr (uniqid(rand()), 0, 6); |
30 |
$orgpassword = $password |
|
04 |
if (! $this ->user[ 'isfounder' ]) { |
05 |
$isprotected = $this ->db->result_first( "SELECT COUNT(*) FROM " .UC_DBTABLEPRE. "protectedmembers WHERE uid = '$uid'" ); |
07 |
$this ->message( 'user_edit_noperm' ); |
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' ); |
19 |
if ( $username != $newusername ) { |
20 |
if ( $_ENV [ 'user' ]->get_user_by_username( $newusername )) { |
21 |
$this ->message( 'admin_user_exists' ); |
23 |
$sqladd .= "username='$newusername', " ; |
25 |
$_ENV [ 'note' ]->add( 'renameuser' , 'uid=' . $uid . '&oldusername=' .urlencode( $username ). '&newusername=' . |
26 |
urlencode( $newusername )); |
29 |
$salt = substr (uniqid(rand()), 0, 6); |
30 |
$orgpassword = $password ; |
31 |
$password = md5(md5( $password ). $salt ); |
32 |
$sqladd .= "password='$password', salt='$salt', " ; |
34 |
$_ENV [ 'note' ]->add( 'updatepw' , 'username=' .urlencode( $username ). '&password=' ); |
37 |
$sqladd .= "secques='', " ; |
39 |
if (! empty ( $delavatar )) { |
40 |
$_ENV [ 'user' ]->delete_useravatar( $uid ); |
43 |
$this ->db->query( "UPDATE " .UC_DBTABLEPRE. "members SET $sqladd email='$email' WHERE uid='$uid'" ); |
44 |
$status = $this ->db->errno() ? -1 : 1; |
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' ); |
有些站长在UCenter修改用户名后,Discuz! 并没有显示出来效果,造成无效的原因主要是通信问题, 如果你的站点显示通信成功且配置文件和UCenter应用管理当中的一致,则在UCenter修改用户信息后,会自动通知Discuz!修改相关用户信息 的,如果修改之前,通信失败,修复通信后,可以到UCenter的通知列表里,点击发送通知,一样会修改Discuz! 的用户信息的。在UCenter里执行修改用户信息时,调用onedit函数
04 |
if (! $this ->user[ 'isfounder' ]) { |
05 |
$isprotected = $this ->db->result_first( "SELECT COUNT(*) FROM " .UC_DBTABLEPRE. "protectedmembers WHERE uid = '$uid'" ); |
07 |
$this ->message( 'user_edit_noperm' ); |
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' ); |
19 |
if ( $username != $newusername ) { |
20 |
if ( $_ENV [ 'user' ]->get_user_by_username( $newusername )) { |
21 |
$this ->message( 'admin_user_exists' ); |
23 |
$sqladd .= "username='$newusername', " ; |
25 |
$_ENV [ 'note' ]->add( 'renameuser' , 'uid=' . $uid . '&oldusername=' .urlencode( $username ). '&newusername=' . |
26 |
urlencode( $newusername )); |
29 |
$salt = substr (uniqid(rand()), 0, 6); |
30 |
$orgpassword = $password ; |
31 |
$password = md5(md5( $password ). $salt ); |
32 |
$sqladd .= "password='$password', salt='$salt', " ; |
34 |
$_ENV [ 'note' ]->add( 'updatepw' , 'username=' .urlencode( $username ). '&password=' ); |
37 |
$sqladd .= "secques='', " ; |
39 |
if (! empty ( $delavatar )) { |
40 |
$_ENV [ 'user' ]->delete_useravatar( $uid ); |
43 |
$this ->db->query( "UPDATE " .UC_DBTABLEPRE. "members SET $sqladd email='$email' WHERE uid='$uid'" ); |
44 |
$status = $this ->db->errno() ? -1 : 1; |
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' ); |
|
这个函数首先判断是该用户受保护,然后就是判断是否提交了修改,当提交后,判断用户名是否修改,密码是否做了修改,验证问题及头像等是否修改,如果做了修 改,调用add()方法在notelist表保存更新内容,当修改成功后,二次调用send方法时,会自动向各个UCenter应用发出执行命令,更新对 应用户的信息,并保存通知,如果不成功,提示通知失败,并指向链接,手动通知。 本文出自:亿恩科技【www.enkj.com】
服务器租用/服务器托管中国五强!虚拟主机域名注册顶级提供商!15年品质保障!--亿恩科技[ENKJ.COM]
|