From: tjhunt Date: Sat, 4 Jul 2009 14:22:11 +0000 (+0000) Subject: Add a warning that require_capabiliy can only be used before output is started. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8a9c1c1c2d7da643dd8ea0f0ccb18a69aac55918;p=moodle.git Add a warning that require_capabiliy can only be used before output is started. --- diff --git a/lib/accesslib.php b/lib/accesslib.php index afaf568e28..c4296104d4 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -1049,6 +1049,10 @@ function aggregate_roles_from_accessdata($context, $accessdata) { * This is an easy to use function, combining has_capability() with require_course_login(). * And will call those where needed. * + * NOTE becuase this function calls require_login, and becuase require_login tries + * to initialise $PAGE->course, and the themes, you will get an exception if you + * try to call require_login after output has started, so don't do that. + * * It checks for a capability assertion being true. If it isn't * then the page is terminated neatly with a standard error message. *