$module = context_module::get(); $name = $module->name; //Output: Returns the name of the current module
$module = context_module::get(); $context = $module->contextlevel; //Output: Returns the context of the current module
$module = context_module::get(); $userid = $module->instance->userid; //Output: Returns the user id of the user accessing the moduleThis code example retrieves the current context module and gets the user id of the user accessing the module. This is useful when you need to reference the user that is currently using the module. The context_module is a part of the Moodle PHP framework library that provides developers with the tools needed to build complex e-learning applications.