Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Better handling of guest user

  • Loading branch information...
commit 603d4c7226bfbb9cf26cd61895625cad42dcc389 1 parent a9b07c5
martin authored
Showing with 10 additions and 4 deletions.
  1. +4 −0 user/edit.php
  2. +6 −4 user/view.php
View
4 user/edit.php
@@ -21,6 +21,10 @@
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.
View
10 user/view.php
@@ -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) {
@@ -112,7 +114,7 @@
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\">";
Please sign in to comment.
Something went wrong with that request. Please try again.