[geeklog-cvs] geeklog-1.3/public_html/admin user.php,1.51,1.52
geeklog-cvs-admin at lists.geeklog.net
geeklog-cvs-admin at lists.geeklog.net
Thu Jun 12 05:26:19 EDT 2003
Update of /usr/cvs/geeklog/geeklog-1.3/public_html/admin
In directory internal.geeklog.net:/tmp/cvs-serv5884/admin
Modified Files:
user.php
Log Message:
Modified "delete user" to assign all stories and comments by the deleted user to "Anonymous" (to prevent orphaned stories/comments).
Index: user.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/admin/user.php,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** user.php 25 Apr 2003 09:07:02 -0000 1.51
--- user.php 12 Jun 2003 09:26:17 -0000 1.52
***************
*** 525,528 ****
--- 525,559 ----
}
+ function delete_user ($uid)
+ {
+ global $_CONF, $_TABLES;
+
+ // Ok, delete everything related to this user
+
+ // first, remove from all security groups
+ DB_delete ($_TABLES['group_assignments'], 'ug_uid', $uid);
+
+ // remove user information and preferences
+ DB_delete ($_TABLES['userprefs'], 'uid', $uid);
+ DB_delete ($_TABLES['userindex'], 'uid', $uid);
+ DB_delete ($_TABLES['usercomment'], 'uid', $uid);
+ DB_delete ($_TABLES['userinfo'], 'uid', $uid);
+
+ // Call custom account profile delete function if enabled and exists
+ if ($_CONF['custom_registration'] AND function_exists (custom_userdelete)) {
+ custom_userdelete ($uid);
+ }
+
+ // let plugins update their data for this user
+ PLG_deleteUser ($uid);
+
+ // avoid having orphand stories/comments by making them anonymous posts
+ DB_query ("UPDATE {$_TABLES['comments']} SET uid = 1 WHERE uid = $uid");
+ DB_query ("UPDATE {$_TABLES['stories']} SET uid = 1 WHERE uid = $uid");
+
+ // now delete the user itself
+ DB_delete ($_TABLES['users'], 'uid', $uid);
+ }
+
// MAIN
if (($mode == $LANG28[19]) && !empty ($LANG28[19])) { // delete
***************
*** 531,554 ****
$display .= COM_refresh ($_CONF['site_admin_url'] . '/user.php');
} else {
! // Ok, delete everything related to this user
!
! // first, remove from all security groups
! DB_delete($_TABLES['group_assignments'],'ug_uid',$uid);
! DB_delete($_TABLES['userprefs'],'uid',$uid);
! DB_delete($_TABLES['userindex'],'uid',$uid);
! DB_delete($_TABLES['usercomment'],'uid',$uid);
! DB_delete($_TABLES['userinfo'],'uid',$uid);
!
! // Call custom account profile delete function if enabled and exists
! if ($_CONF['custom_registration'] AND (function_exists(custom_userdelete))) {
! custom_userdelete($uid);
! }
!
! PLG_deleteUser ($uid);
!
! // what to do with orphan stories/comments?
!
! // now move delete the user itself
! DB_delete($_TABLES['users'],'uid',$uid,$_CONF['site_admin_url'] . '/user.php?msg=22');
}
} else if (($mode == $LANG28[20]) && !empty ($LANG28[20])) { // save
--- 562,567 ----
$display .= COM_refresh ($_CONF['site_admin_url'] . '/user.php');
} else {
! delete_user ($uid);
! $display .= COM_refresh ($_CONF['site_admin_url'] . '/user.php?msg=22');
}
} else if (($mode == $LANG28[20]) && !empty ($LANG28[20])) { // save
More information about the geeklog-cvs
mailing list