MDL-49412 navigation: Isset check on email setting.
authorAdrian Greeve <adrian@moodle.com>
Thu, 9 Apr 2015 02:24:32 +0000 (10:24 +0800)
committerAdrian Greeve <adrian@moodle.com>
Fri, 10 Apr 2015 09:18:24 +0000 (17:18 +0800)
The messaging preferences doesn't always seem to show the
email settings during behat tests and when updating details
will throw a warning.

Part of MDL-45774.

message/edit.php

index fc6b01e..4d1b54f 100644 (file)
@@ -130,7 +130,9 @@ if (($form = data_submitted()) && confirm_sesskey()) {
         print_error('cannotupdateusermsgpref');
     }
 
         print_error('cannotupdateusermsgpref');
     }
 
-    $user->mailformat = clean_param($form->mailformat, PARAM_INT);
+    if (isset($form->mailformat)) {
+        $user->mailformat = clean_param($form->mailformat, PARAM_INT);
+    }
     user_update_user($user, false, false);
 
     redirect("$CFG->wwwroot/message/edit.php?id=$user->id");
     user_update_user($user, false, false);
 
     redirect("$CFG->wwwroot/message/edit.php?id=$user->id");