General developer forum

Moodle 2.4, multiple emails for single user

 
Picture of Ian Persifal
Moodle 2.4, multiple emails for single user
 
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: -