After instantiating moodle via "external"
require_once('../config.php');
In an SSO scenario within the application (i.e. MRBS), when looking up whether the currently logged in user has certain capabilities for a specific block, I get the error: Exception - class "MRBS\Session\context_block" not found
:
if (has_capability('moodle/block:edit', context_block::instance($blockid)){}
I guess it’s because the namespace is set to namespace MRBS\Session;
How to correctly quote context_block::instance()
?
Moodle functions apparently work (e.g. require_login(), has_capability). Thanks
You need to write:
Use the "\" character to declare context_block in the top-level namespace.
Or you need to put the following at the top of the file:
I personally prefer the first option, but that's usually a matter of personal preference.