3

I need $cm->id Because In latest Moodle 2.6.0 Version.
$context = get_context_instance(CONTEXT_MODULE, $courseId);
Not Working Above Code.
Instead Of this given code I need to implement.

$contextmodule = context_module::instance($cm->id);
Use of this code i need $contextId;

Hence my point is how can I get $cm->id Or $contextmodule using $courseId.

Thanks in advance.

gnuwings
  • 950
  • 7
  • 8

1 Answers1

2

You should use course module ID as the argument for the function.

$contextModuleData = context_module::instance($contextModule->id);
Pang
  • 9,564
  • 146
  • 81
  • 122
gnuwings
  • 950
  • 7
  • 8