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.
// 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 '';
}