From: skodak <skodak>
Date: Thu, 15 Feb 2007 20:43:00 +0000 (+0000)
Subject: fixed problem on user edit page when user not fully setup
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=03a2aac1ecc3a982fb8ec47ce28a2a65e7c2cf9e;p=moodle.git

fixed problem on user edit page when user not fully setup
---

diff --git a/user/edit.php b/user/edit.php
index 81adcbb434..4c49b9534f 100644
--- a/user/edit.php
+++ b/user/edit.php
@@ -14,12 +14,21 @@
         error('Course ID was incorrect');
     }
 
-    require_login($course->id);
+    if ($course->id != SITEID) {
+        require_login($course);
+    } else if (!isloggedin()) {
+        // user might not be fully setup, do not use require login here!
+        if (empty($CFG->loginhttps)) {
+            redirect($CFG->wwwroot .'/login/index.php');
+        } else {
+            $wwwroot = str_replace('http:','https:', $CFG->wwwroot);
+            redirect($wwwroot .'/login/index.php');
+        }
+    }
 
-    if (isguest()) { //TODO: add proper capability to edit own profile and change password too
+    if (isguestuser()) {
         print_error('guestnoeditprofile');
     }
-
     if (!$user = get_record('user', 'id', $USER->id)) {
         error('User ID was incorrect');
     }