General developer forum

 
 
Picture of Chris Jenkins
Re: I'm new to Moodle and need to create a trigger
 

Thanks Richard!

Thats good news, it looks like I just create a "course completed" handler and register it by including it in mdl_events_handlers table:

INSERT INTO `moodle`.`mdl_events_handlers` (`id`, `eventname`, `component`, `handlerfile`, `handlerfunction`, `schedule`, `status`, `internal`) VALUES ('18', 'course_completed', 'mod_sp', '/mod/sp/lib.php', 'a:2:{i:0;s:18:\"enrol_meta_handler\";i:1;s:14:\"course_completed\";}', 'instant', '0', '1');

 Then I just implement the lib.php handler and bob's your uncle!

Does this sound right.. anyone?  

 
Average of ratings: -
Picture of Rex Lorenzo
Re: I'm new to Moodle and need to create a trigger
Group DevelopersGroup Particularly helpful MoodlersGroup Testers

Yikes, no, you shouldn't register to handle an event that way.

Please read the "Handling an event" part of the documentation:

http://docs.moodle.org/dev/Events_API#Example

There is a code example in the mod/forum directory.

 
Average of ratings: -