// 7. OTHER MISCELLANEOUS SETTINGS (ignore these for new installations)
//=========================================================================
//
+// These are additional tweaks for which no GUI exists in Moodle yet.
+//
+//
// Prevent users from updating their profile images
// $CFG->disableuserimages = true;
//
//
// Setting this to true will force a non-guest login to see the user pages
// eg the teachers linked from course descriptions or site news
-// $CFG->forceloginforprofiles
+// $CFG->forceloginforprofiles = true;
+//
+// Setting this variable will make Moodle allow anything as a username,
+// rather than alphanumerical characters only.
+// $CFG->extendedusernamechars = true;
//
// This setting will put Moodle in Unicode mode. It's very new and
// most likely doesn't work yet. THIS IS FOR DEVELOPERS ONLY, IT IS
function validate_form($user, &$err) {
global $CFG;
+
if (empty($user->username)){
$err->username = get_string("missingusername");
} else{
if (record_exists("user", "username", $user->username)){
$err->username = get_string("usernameexists");
} else {
- $string = eregi_replace("[^(-\.[:alnum:][À-ÖØ-öø-ÿ])]", "", $user->username);
- if (strcmp($user->username, $string)) {
- $err->username = get_string("alphanumerical");
+ if (empty($CFG->extendedusernamechars)) {
+ $string = eregi_replace("[^(-\.[:alnum:])]", "", $user->username);
+ if (strcmp($user->username, $string)) {
+ $err->username = get_string("alphanumerical");
+ }
}
}
}
/// FUNCTIONS ////////////////////
function find_form_errors(&$user, &$usernew, &$err) {
+ global $CFG;
if (isadmin()) {
if (empty($usernew->username)) {
$err["username"] = get_string("usernameexists");
} else {
- $string = eregi_replace("[^(-\.[:alnum:][À-ÖØ-öø-ÿ])]", "", $usernew->username);
-
- if (strcmp($usernew->username, $string))
- $err["username"] = get_string("alphanumerical");
+ if (empty($CFG->extendedusernamechars)) {
+ $string = eregi_replace("[^(-\.[:alnum:])]", "", $usernew->username);
+ if (strcmp($usernew->username, $string)) {
+ $err["username"] = get_string("alphanumerical");
+ }
+ }
}
if (empty($usernew->newpassword) and empty($user->password) and is_internal_auth() )