From: moodler Date: Sat, 25 Sep 2004 12:53:35 +0000 (+0000) Subject: user id and course id are both now optional X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e41ddc4b02f31cf2b84654f0119fcdd3db69ad9f;p=moodle.git user id and course id are both now optional --- diff --git a/user/edit.php b/user/edit.php index 9a302b276e..32c26f6502 100644 --- a/user/edit.php +++ b/user/edit.php @@ -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"); diff --git a/user/view.php b/user/view.php index d34bf3c7e6..c95c4728b9 100644 --- a/user/view.php +++ b/user/view.php @@ -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");