ndunand/moodle-mergeusers — pull request #18 by jpahullo (2014-01-13 10:15:23+00:00)
Title: moodle-tool_mergeusers - added events for post-merging actions

* Added event triggering of 'merging_success' and 'merging_failed' events,
for when the merging actions was done ok or failed for some reason, respectively.
The goal is that other plugins and parts of Moodle would be able to
manage this kind of events when necessary. The data provided in the event is:
* oldid : user.id for the user to be removed/deactivated.
* newid : user.id for the user to gather the activity from both users and
will remain in the system.
* log : list of actions recorded when merging. On success, it will contain
all actions done successfully; on failure, it will contain the error
that prevented from merging.
* timemodified : time when merging action concluded.
* Added event handler for when merging was success, by doing:
* suspending the user (flag user.suspended = 1).
* changing profile picture to the given by pix/suspended.jpg if it exists.
The idea is to clarify which user is actually active and which was the old one.
* Anyone can add more actions by, for instance, extending the handler for
the merging_success event, or implementing a handler for the merging_failed event.
For instance, you could send an email to notify a failed merging.
From other plugins viewpoint, you can add handlers to process those events.