Moodle 2.4, multiple emails for single user

Moodle 2.4, multiple emails for single user

by Ian Persifal -
Number of replies: 0
Hello,
I need to add another "private email" to many Moodle Users - for to complex reasons to explain here. So I've added the below code to "moodle/lib/moodlelib.php":

// Find this original line and add the new code after...
$temprecipients[] = array($user->email, fullname($user));

// Code for sending email to another private email address, if specified in Profile
require_once($CFG->dirroot.'/user/profile/lib.php');
profile_load_custom_fields($user);
if (isset($user->profile['privatemail'])) {
    $temprecipients[] = array($user->profile['privatemail'], fullname($user));
}

I know that change the core is a BAD thing to do, but I don't know actually anoher way to do so (I don't know if a plugin is the solution and I haven't understood how to do it). Any suggestion is welcome.
Thanks to all!
Average of ratings: -