Permalink
Browse files

Changes to enable DELETION of user accounts. Accounts aren't actually

deleted, they are just marked with a deleteion flag that prevents them
from logging in, or from being listed anywhere.
  • Loading branch information...
1 parent 3869a2a commit bb09fb1157a80871a592639c2a0f6cd45492c592 martin committed Sep 22, 2002
Showing with 225 additions and 21 deletions.
  1. +184 −0 CHANGES
  2. +25 −14 admin/user.php
  3. +8 −6 lib/moodlelib.php
  4. +4 −0 user/view.php
  5. +4 −1 version.php
View
184 CHANGES
@@ -1,3 +1,187 @@
+2002-09-21 Saturday 15:46 martin
+
+ * mod/: assignment/lib.php, forum/lib.php, journal/lib.php:
+
+ Make sure mailouts are in the user's chosen language
+
+2002-09-21 Saturday 15:42 martin
+
+ * mod/forum/lib.php:
+
+ Make sure mailouts are in the chosen language of each user
+
+2002-09-21 Saturday 15:27 martin
+
+ * lang/fr/: assignment.php, choice.php, forum.php, journal.php,
+ moodle.php, reading.php, survey.php, help/coursecategory.html,
+ help/courseformats.html, help/coursefullname.html,
+ help/coursenewsitems.html, help/coursenumsections.html,
+ help/courseshortname.html, help/coursestartdate.html,
+ help/enrolmentkey.html, help/guestaccess.html, help/picture.html,
+ help/questions.html, help/surveys.html, help/text.html,
+ help/forum/allowdiscussions.html, help/forum/forumtype.html,
+ help/forum/ratings.html, help/forum/subscription.html,
+ help/reading/readingtype.html, help/reading/summary.html:
+
+ Initial (incomplete) version of French translation by Sebastien
+ Nameche <snameche@virtual-net.fr>
+
+ Good start! Thanks, Sebastien.
+
+2002-09-21 Saturday 15:22 martin
+
+ * lang/fi/: README, assignment.php, choice.php, forum.php,
+ journal.php, moodle.php, reading.php, survey.php, testupdate.php,
+ docs/module_files.txt, help/coursecategory.html,
+ help/courseformats.html, help/coursefullname.html,
+ help/coursenewsitems.html, help/coursenumsections.html,
+ help/courseshortname.html, help/coursestartdate.html,
+ help/enrolmentkey.html, help/guestaccess.html, help/html.html,
+ help/picture.html, help/questions.html, help/surveys.html,
+ help/teachers.html, help/text.html, help/choice/options.html,
+ help/forum/allowdiscussions.html, help/forum/attachment.html,
+ help/forum/forumtype.html, help/forum/ratings.html,
+ help/forum/subscription.html, help/reading/readingtype.html,
+ help/reading/summary.html:
+
+ Initial version of Finnish translation, as done by Petri Asikainen
+ <paca@sci.fi>
+
+ Thanks, Petri!
+
+2002-09-21 Saturday 15:18 martin
+
+ * lang/en/: assignment.php, choice.php, forum.php, journal.php,
+ moodle.php, reading.php, survey.php:
+
+ Added single quotes around all the keys ... even though PHP works
+ without them, it will flag errors when errorlevel is turned up, and
+ I suspect this slows it all down a bit.
+
+2002-09-21 Saturday 15:07 martin
+
+ * lang/en/README:
+
+ Added my email address
+
+2002-09-21 Saturday 15:03 martin
+
+ * course/view.php:
+
+ Don't need to log in to see site-level course
+
+2002-09-21 Saturday 14:45 martin
+
+ * admin/config.html:
+
+ More options for longtimenosee
+
+2002-09-21 Saturday 14:39 martin
+
+ * user/: index.php, lib.php:
+
+ Don't print pictures at all for very large lists
+
+2002-09-21 Saturday 14:30 martin
+
+ * user/index.php:
+
+ Make more room in list
+
+2002-09-21 Saturday 14:27 martin
+
+ * user/: index.php, lib.php:
+
+ more refinements to sorting display
+
+2002-09-21 Saturday 14:13 martin
+
+ * user/index.php:
+
+ Fixed typo from testing
+
+2002-09-21 Saturday 14:12 martin
+
+ * pix/t/down.gif, pix/t/up.gif, user/index.php:
+
+ Much better look for user index
+
+2002-09-21 Saturday 13:43 martin
+
+ * lib/moodlelib.php:
+
+ Slight additions to print_table
+
+2002-09-21 Saturday 13:43 martin
+
+ * lib/db/mysql.sql:
+
+ Added lang for users
+
+2002-09-21 Saturday 13:42 martin
+
+ * user/: index.php, lib.php:
+
+ Better display of users in shortened form, for testing
+
+2002-09-20 Friday 23:42 martin
+
+ * user/lib.php:
+
+ Tweak
+
+2002-09-20 Friday 23:40 martin
+
+ * user/: index.php, lib.php:
+
+ First go at an abbreviated user listing
+
+2002-09-19 Thursday 22:59 martin
+
+ * admin/config.php:
+
+ Put sitename on debugging info (helpful when comparing two sites)
+
+2002-09-19 Thursday 22:51 martin
+
+ * course/teachers.php, lang/en/moodle.php,
+ lang/en/help/teachers.html, lib/weblib.php:
+
+ Improved interface for course/teachers.php ... instead of typing
+ numbers into a box there is now a menu for each user. Much
+ better!
+
+2002-09-19 Thursday 22:07 martin
+
+ * admin/config.html, lib/defaults.php, lib/setup.php:
+
+ Got rid of errorlevel configuration - more trouble than it's worth!
+ Hardcoded it into setup.php now - people who are that keen can
+ change it there.
+
+2002-09-19 Thursday 22:06 martin
+
+ * doc/install.html:
+
+ Updated for new configuration page
+
+2002-09-19 Thursday 21:55 martin
+
+ * course/edit.php, user/edit.php:
+
+ Some consistency in headers on editing forms
+
+2002-09-19 Thursday 20:01 martin
+
+ * CHANGES, config-dist.php, version.php, admin/config.html,
+ admin/config.php, admin/index.php, admin/site.php, course/lib.php,
+ lang/en/moodle.php, lib/defaults.php, lib/moodlelib.php,
+ lib/setup.php:
+
+ Most of the configuration variables have been moved out of the
+ config.php file and into a database, where they can be edited using
+ a new admin form called "Configure variables".
+
2002-09-17 Tuesday 22:56 martin
* error/index.php:
View
@@ -80,26 +80,37 @@
} else { // List all users for editing
- if ($users = get_records_sql("SELECT * from user WHERE username <> 'guest' ORDER BY firstname")) {
- $stredituser = get_string("edituser");
- $stradministration = get_string("administration");
- $stredit = get_string("edit");
- $strdelete = get_string("delete");
-
- print_header("$site->fullname : $stredituser", $site->fullname,
- "<A HREF=\"$CFG->wwwroot/admin\">$stradministration</A> -> $stredituser");
+ $stredituser = get_string("edituser");
+ $stradministration = get_string("administration");
+ $stredit = get_string("edit");
+ $strdelete = get_string("delete");
+ $strdeletecheck = get_string("deletecheck");
+
+ print_header("$site->fullname : $stredituser", $site->fullname,
+ "<A HREF=\"$CFG->wwwroot/admin\">$stradministration</A> -> $stredituser");
+
+ if ($delete) {
+ if ($deleteuser = get_record("user", "id", "$delete")) {
+ if (set_field("user", "deleted", "1", "id", "$delete")) {
+ set_field("user", "timemodified", time(), "id", "$delete");
+ notify(get_string("deletedactivity", "", "$deleteuser->firstname $deleteuser->lastname"));
+ }
+ }
+ }
+ if ($users = get_records_sql("SELECT * from user WHERE username <> 'guest' AND deleted <> '1' ORDER BY firstname")) {
print_heading(get_string("chooseuser"));
$table->head = array (get_string("fullname"), get_string("email"), get_string("city"),
- get_string("country"), " ");
- $table->align = array ("LEFT", "LEFT", "CENTER", "CENTER", "CENTER", "CENTER");
+ get_string("country"), " ", " ");
+ $table->align = array ("LEFT", "LEFT", "CENTER", "CENTER", "CENTER", "CENTER", "CENTER");
foreach ($users as $user) {
$table->data[] = array ("<A HREF=\"../user/view.php?id=$user->id&course=$site->id\">$user->firstname $user->lastname</A>",
- "$user->email",
- "$user->city",
- $COUNTRIES[$user->country],
- "<A HREF=\"../user/edit.php?id=$user->id&course=$site->id\">$stredit</A>");
+ "$user->email",
+ "$user->city",
+ $COUNTRIES[$user->country],
+ "<A HREF=\"../user/edit.php?id=$user->id&course=$site->id\">$stredit</A>",
+ "<A HREF=\"user.php?delete=$user->id\" TARGET=\"$strdeletecheck\">$strdelete</A>");
}
print_table($table);
View
@@ -903,7 +903,7 @@ function get_user_info_from_db($field, $value) {
if (!$field || !$value)
return false;
- $result = $db->Execute("SELECT * FROM user WHERE $field = '$value'");
+ $result = $db->Execute("SELECT * FROM user WHERE $field = '$value' AND deleted = '0'");
if ( $result->RecordCount() == 1 ) {
$user = (object)$result->fields;
@@ -1127,7 +1127,7 @@ function verify_login($username, $password) {
if (! $user) {
return false;
- } else if ( $user->password == md5($password) ) {
+ } else if ( $user->password == md5($password) and ! $user->deleted ) {
return $user;
} else {
return false;
@@ -1148,7 +1148,7 @@ function get_admin () {
if ( $admins = get_records_sql("SELECT u.* FROM user u, user_admins a WHERE a.user = u.id ORDER BY u.id ASC")) {
foreach ($admins as $admin) {
- return $admin; // ie the first one (yeah I know it's bodgy)
+ return $admin; // ie the first one
}
} else {
return false;
@@ -1161,7 +1161,9 @@ function get_teacher($courseid) {
WHERE t.user = u.id AND t.course = '$courseid'
ORDER BY t.authority ASC")) {
foreach ($teachers as $teacher) {
- return $teacher; // ie the first one (yeah I know it's bodgy)
+ if ($teacher->authority) {
+ return $teacher; // the highest authority teacher
+ }
}
} else {
return false;
@@ -1170,13 +1172,13 @@ function get_teacher($courseid) {
function get_course_students($courseid, $sort="u.lastaccess DESC") {
return get_records_sql("SELECT u.* FROM user u, user_students s
- WHERE s.course = '$courseid' AND s.user = u.id
+ WHERE s.course = '$courseid' AND s.user = u.id AND u.deleted = '0'
ORDER BY $sort");
}
function get_course_teachers($courseid, $sort="t.authority ASC") {
return get_records_sql("SELECT u.*,t.authority,t.role FROM user u, user_teachers t
- WHERE t.course = '$courseid' AND t.user = u.id
+ WHERE t.course = '$courseid' AND t.user = u.id AND u.deleted = '0'
ORDER BY $sort");
}
View
@@ -45,6 +45,10 @@
}
}
+ if ($user->deleted) {
+ print_heading(get_string("userdeleted"));
+ }
+
echo "<TABLE WIDTH=80% ALIGN=CENTER BORDER=0 CELLPADDING=1 CELLSPACING=1><TR><TD BGCOLOR=#888888>";
echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=3 CELLSPACING=0><TR>";
echo "<TD WIDTH=100 BGCOLOR=\"$THEME->body\" VALIGN=top>";
View
@@ -18,7 +18,7 @@
// If there's something it cannot do itself, it
// will tell you what you need to do.
-$version = 2002092000; // The current version is a date (YYYYMMDDXX) where
+$version = 2002092100; // The current version is a date (YYYYMMDDXX) where
// XX is a number that increments during the day
$release = "1.0.5 dev"; // For humans only, not used for the upgrade process
@@ -77,6 +77,9 @@ function upgrade_moodle($oldversion=0) {
if ($oldversion < 2002092000) {
execute_sql(" ALTER TABLE `user` CHANGE `lang` `lang` VARCHAR(5) DEFAULT 'en' NOT NULL ");
}
+ if ($oldversion < 2002092100) {
+ execute_sql(" ALTER TABLE `user` ADD `deleted` TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL AFTER `confirmed` ");
+ }
return true;
}

0 comments on commit bb09fb1

Please sign in to comment.