Get content from course module

Re: Get content from course module

by Benjamin Ellis -
Number of replies: 0
Picture of Particularly helpful Moodlers

The observer function will get an 'event' object passed in and for course modules, the course module id is $event->objectid and the module information is in the $event->other array 

'other'    => array(
'modulename' => $cm->modname,
'instanceid' => $cm->instance,
'name'       => $cm->name,
)

so you can use that to get the table record e.g.

$record = $DB->get_record($event->other['modname'], array('id' => $event->other['instanceid']);

Cheers