Better handling of guest user
authormartin <martin>
Mon, 10 Jun 2002 04:33:46 +0000 (04:33 +0000)
committermartin <martin>
Mon, 10 Jun 2002 04:33:46 +0000 (04:33 +0000)
user/edit.php
user/view.php

index 1b5aca55e84a64e96cc6008063e8b7a18ccb812e..36db01e35fee7fefde2026c1361df56f0a3c2346 100644 (file)
         error("You can only edit your own information");
     }
 
+    if (isguest()) {
+        error("The guest user cannot edit their profile.");
+    }
+
 
 /// If data submitted, then process and store.
 
index 73be896783d159acdb72892f9d0d99c7cbabbe0d..e1026d09c52c8f735537f35ff6ba3b6e19d39bc4 100644 (file)
@@ -35,7 +35,7 @@
         print_header("Personal profile: $fullname", "Personal profile: $fullname", "$fullname", "");
     }
 
-    if ($course->category) {
+    if ($course->category and ! isguest() ) {
         if (!isstudent($course->id, $user->id) && !isteacher($course->id, $user->id)) {
             print_heading("$fullname is not enrolled in this course");
             print_footer($course);
@@ -59,7 +59,7 @@
     echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD NOWRAP>";
     echo "<H3>$user->firstname $user->lastname</H3>";
     echo "</TD><TD align=right>";
-    if ($id == $USER->id) {
+    if ($id == $USER->id and !isguest()) {
         echo "<P><FORM ACTION=edit.php METHOD=GET>";
         echo "<INPUT type=hidden name=id value=\"$id\">";
         echo "<INPUT type=hidden name=course value=\"$course->id\">";
@@ -80,7 +80,9 @@
 
     echo "<TABLE BORDER=0 CELLPADDING=5 CELLSPACING=2";
 
-    print_row("Location:", "$user->city, ".$COUNTRIES["$user->country"]);
+    if ($user->city or $user->country) {
+        print_row("Location:", "$user->city, ".$COUNTRIES["$user->country"]);
+    }
 
     if (isteacher($course->id)) {
         if ($user->address) {
     echo "</TD></TR></TABLE></TABLE>";
 
 //  Print other functions
-    if ($id == $USER->id) {
+    if ($id == $USER->id and !isguest() ) {
         echo "<CENTER><TABLE ALIGN=CENTER><TR>";
         echo "<TD NOWRAP><P><FORM ACTION=\"../course/unenrol.php\" METHOD=GET>";
         echo "<INPUT type=hidden name=id value=\"$course->id\">";