MDL-56822 messaging: Hide notification icons on site policy screen
authorCameron Ball <cameron@moodle.com>
Fri, 11 Nov 2016 09:18:12 +0000 (17:18 +0800)
committerCameron Ball <cameron@moodle.com>
Thu, 17 Nov 2016 04:10:52 +0000 (12:10 +0800)
If we have the nofications and messaging popovers displaying on the
policy confirmation screen we hit an exception since the webservices
won't work if the policy hasn't been agreed to.

This patch simply stops them from showing if the site policy hasn't
been agreed to.

message/output/popup/lib.php

index 8875855..6ab437b 100644 (file)
@@ -35,7 +35,8 @@ function message_popup_render_navbar_output(\renderer_base $renderer) {
 
     // Early bail out conditions.
     if (!isloggedin() || isguestuser() || user_not_fully_set_up($USER) ||
-        get_user_preferences('auth_forcepasswordchange')) {
+        get_user_preferences('auth_forcepasswordchange') ||
+        (!$USER->policyagreed && $CFG->sitepolicy)) {
         return '';
     }