From 8a9c1c1c2d7da643dd8ea0f0ccb18a69aac55918 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Sat, 4 Jul 2009 14:22:11 +0000 Subject: [PATCH] Add a warning that require_capabiliy can only be used before output is started. --- lib/accesslib.php | 4 ++++ 1 file changed, 4 insertions(+) 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. * -- 2.39.5