]> git.mjollnir.org Git - moodle.git/commitdiff
user id and course id are both now optional
authormoodler <moodler>
Sat, 25 Sep 2004 12:53:35 +0000 (12:53 +0000)
committermoodler <moodler>
Sat, 25 Sep 2004 12:53:35 +0000 (12:53 +0000)
user/edit.php
user/view.php

index 9a302b276e825e5955154595e6639006980fa25a..32c26f6502fc2d81b77c878494536e8bc71b7b53 100644 (file)
@@ -3,10 +3,17 @@
     require_once("../config.php");
     require_once("$CFG->libdir/gdlib.php");
 
-    require_variable($id);       // user id
-    require_variable($course);   // course id
+    optional_variable($id);       // user id
+    optional_variable($course);   // course id
 
+    if (empty($id)) {         // See your own profile by default
+        require_login();
+        $id = $USER->id;
+    }
 
+    if (empty($course)) {     // See it at site level by default
+        $course = SITEID;
+    }
 
     if (! $user = get_record("user", "id", $id)) {
         error("User ID was incorrect");
index d34bf3c7e6fc9c0a2cc9e3c0a9da30d97ce54523..c95c4728b9e9864f28c3dcc659aa934cec68437c 100644 (file)
@@ -5,11 +5,19 @@
     require_once("../config.php");
     require_once("../mod/forum/lib.php");
 
-    require_variable($id);
-    require_variable($course);
+    optional_variable($id);
+    optional_variable($course);
     optional_variable($enable, "");
     optional_variable($disable, "");
 
+    if (empty($id)) {         // See your own profile by default
+        require_login();
+        $id = $USER->id;
+    }
+
+    if (empty($course)) {     // See it at site level by default
+        $course = SITEID;
+    }
 
     if (! $user = get_record("user", "id", $id) ) {
         error("No such user in this course");