I'm writing the local custom code for my moodle. When user enroll to a course it shoud to catch the event. But nothing happend
This is my code:
lib.php:
<?php
defined('MOODLE_INTERNAL') || die();
function local_newenrollment_user_enrolled($tbc) {
echo "I m here";
return true;
}
event.php
<?php
defined('MOODLE_INTERNAL') || die();
$handlers = array (
'user_enrolled' => array (
'handlerfile' => '/mod/forum/lib.php',
'handlerfunction' => 'forum_user_enrolled',
'schedule' => 'instant',
'internal' => 1,
),
);
version.php
<?php
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014012901; // Plugin version.
$plugin->requires = 2013051402; // Moodle version.
$plugin->component = 'local_newenrollment'; // Full name of the plugin (used for diagnostics).
Somebody can help?
You have declared the function to call as 'forum_user_enrolled', but the function you have created is called 'local_newenrolment_user_enrolled'. You have also stated that the function is in 'mod/forum/lib.php', not in your plugin's lib file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.