Example #1
0
             $extAuthPasswordCount++;
         }
     }
     if ($passwordFound) {
         /*
          * Prepare the email message wich has to be send to the user
          */
         // mail subject
         $emailSubject = get_lang('Login request') . ' ' . get_conf('siteName');
         $blockLoginInfo = '';
         foreach ($userAccountList as $userAccount) {
             $blockLoginInfo .= get_block('blockLoginInfo', array('%firstname' => $userAccount['firstname'], '%lastname' => $userAccount['lastname'], '%username' => $userAccount['username'], '%password' => $userAccount['password']));
         }
         $emailBody = get_block('blockLoginRequest', array('%siteName' => get_conf('siteName'), '%rootWeb' => get_path('rootWeb'), '%loginInfo' => $blockLoginInfo));
         // send message
         if (claro_mail_user($userList[0]['uid'], $emailBody, $emailSubject)) {
             $dialogBox->success(get_lang('Your password has been emailed to') . ' : ' . $emailTo);
         } else {
             $dialogBox->error(get_lang('The system is unable to send you an e-mail.') . '<br />' . get_lang('Please contact') . ' : ' . '<a href="mailto:' . get_conf('administrator_email') . '?BODY=' . $emailTo . '">' . get_lang('Platform administrator') . '</a>');
         }
     }
 } else {
     $dialogBox->error(get_lang('There is no user account with this email address.'));
 }
 if ($extAuthPasswordCount > 0) {
     if ($extAuthPasswordCount == count($userList)) {
         $dialogBox->warning(get_lang('Your password(s) is (are) recorded in an external authentication system outside the platform.'));
     } else {
         $dialogBox->warning(get_lang('Passwords of some of your user account(s) are recorded an in external authentication system outside the platform.'));
     }
     $dialogBox->info(get_lang('For more information take contact with the platform administrator.'));
Example #2
0
/**
 * Send registration succeded email to user
 * @author Mathieu Laurent <*****@*****.**>
 *
 * @param integer $userId
 * @param mixed $data array of user data or null to keep data following $userId param.
 * @return boolean
 */
function user_send_registration_mail($userId, $data, $courseCode = null)
{
    require_once dirname(__FILE__) . '/sendmail.lib.php';
    require_once dirname(__FILE__) . '/../../messaging/lib/message/messagetosend.lib.php';
    require_once dirname(__FILE__) . '/../../messaging/lib/recipient/singleuserrecipient.lib.php';
    if (!empty($data['email'])) {
        // email subjet
        $emailSubject = '[' . get_conf('siteName') . '] ' . get_lang('Your registration');
        // email body
        $emailBody = get_block('blockAccountCreationNotification', array('%firstname' => $data['firstname'], '%lastname' => $data['lastname'], '%username' => $data['username'], '%password' => $data['password'], '%siteName' => get_conf('siteName'), '%rootWeb' => get_path('rootWeb'), '%administratorName' => get_conf('administrator_name'), '%administratorPhone' => get_conf('administrator_phone'), '%administratorEmail' => get_conf('administrator_email')));
        // add information about course manager if user created in course
        if (isset($courseCode)) {
            $courseData = claro_get_course_data($courseCode);
            $emailBody .= get_lang('User created by ') . ' - ' . $courseData['titular'] . ' - ' . $courseData['email'] . ' ( ' . $courseData['officialCode'] . ' - ' . $courseData['name'] . ' )';
        }
        if (claro_mail_user($userId, $emailBody, $emailSubject)) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}