MDL-36778 course - prevent undefined index warnings
authorDan Poltawski <dan@moodle.com>
Fri, 30 Nov 2012 04:15:51 +0000 (12:15 +0800)
committerDan Poltawski <dan@moodle.com>
Fri, 30 Nov 2012 04:27:09 +0000 (12:27 +0800)
When logged in as a guest the mform didn't set userid.

course/recent_form.php

index 349fd58..cfdbffa 100644 (file)
@@ -98,6 +98,9 @@ class recent_form extends moodleform {
 
             $mform->addElement('select', 'user', get_string('participants'), $options);
             $mform->setAdvanced('user');
+        } else {
+            // Default to no user.
+            $mform->addElement('hidden', 'user', 0);
         }
 
         $options = array(''=>get_string('allactivities'));