LMSouq
moodle-core Open

How can i get $cm->id based on the $courseId In Moodle 2.6.0 Version?

GJ
GJK President
1 month ago
3 views
Problem Description
I need **$cm->id** Because In latest Moodle 2.6.0 Version. <br/> `$context = get_context_instance(CONTEXT_MODULE, $courseId);` <br/> Not Working Above Code. <br/> Instead Of this given code I need to implement. **$contextmodule = context_module::instance($cm->id);** <br/> Use of this code i need **$contextId**; Hence my point is how can I get $cm->id Or $contextmodule using $courseId. Thanks in advance.

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base