MDL-29942 trigger user events in web service calls

This commit is contained in:
Jerome Mouneyrac 2011-12-08 14:40:57 +08:00
parent 42f6b3f1d7
commit b6dcb7d984

View File

@ -47,6 +47,10 @@ function user_create_user($user) {
/// insert the user into the database
$newuserid = $DB->insert_record('user', $user);
/// trigger user_created event on the full database user row
$newuser = $DB->get_record('user', array('id' => $newuserid));
events_trigger('user_created', $newuser);
/// create USER context for this user
get_context_instance(CONTEXT_USER, $newuserid);
@ -71,6 +75,11 @@ function user_update_user($user) {
$user->timemodified = time();
$DB->update_record('user', $user);
/// trigger user_updated event on the full database user row
$updateduser = $DB->get_record('user', array('id' => $user->id));
events_trigger('user_updated', $updateduser);
}