From 4c2022285292699665c779b7ceecfaa93b591d96 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 10 May 2005 06:18:30 +0000 Subject: [PATCH] A quick hack to allow anonymising of all names. You can make everyone have the name "Bruce" if you want. }-) --- config-dist.php | 5 +++++ lib/moodlelib.php | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/config-dist.php b/config-dist.php index 2628f05e0a8..260ed6794cc 100644 --- a/config-dist.php +++ b/config-dist.php @@ -234,6 +234,11 @@ $CFG->admin = 'admin'; // Print to footer (works with the default theme) // define('MDL_PERFTOFOOT', true); // +// Force displayed usernames +// A little hack to anonymise user names for all students. If you set these +// then all non-teachers will always see these for every person. +// $CFG->forcefirstname = 'Bruce'; +// $CFG->forcelastname = 'Simpson'; //========================================================================= // ALL DONE! To continue installation, visit your main page with a browser diff --git a/lib/moodlelib.php b/lib/moodlelib.php index d8205c687d0..738490c08cc 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1984,6 +1984,15 @@ function fullname($user, $override=false) { return ''; } + if (!$override) { + if (!empty($CFG->forcefirstname)) { + $user->firstname = $CFG->forcefirstname; + } + if (!empty($CFG->forcelastname)) { + $user->lastname = $CFG->forcelastname; + } + } + if (!empty($SESSION->fullnamedisplay)) { $CFG->fullnamedisplay = $SESSION->fullnamedisplay; }