$invalid['Session'] = l($testSession->getLastError()); } } else { //if user is asking to receive the activation email again if ($paramResendActivate) { //build activation link for email template (resetting activation and reset hashes) $activationLinkForEmail = Auth::buildHashLink('account.activate.folder', array('username' => $user->username(), 'activation' => $user->activation()), true); //set data to be used for replacing placeholders in activation email template $emailTplData = array('emailTo' => $user->email(), 'emailFrom' => c::get('site.email.from'), 'emailReply' => c::get('site.email.reply'), 'siteName' => $site->title(), 'activationLink' => $activationLinkForEmail); //istantiate new emailer object (the object itself will replace placeholders) //the construct props indicate an email template file and a data array $emailer = new emailer(c::get('account.email.templates.folder'), c::get('email.template.activation.hash'), c::get('email.template.file.ext'), $emailTplData); //if the email template is found if ($emailer->doesEmailTemplateExist()) { //if email was correclty sent if ($emailer->sendMail()) { //add success message $success['Account'] = l('activation.success.resend'); } else { //add error: mail class returned an error $invalid['Account'] = l('activation.fail.resend'); } } else { //add error: email template was not found $invalid['Account'] = l('generic.fail.email.template.notFound'); } } else { //build activation link for view $activationLinkForView = Auth::buildHashLink('account.activate.folder', array('username' => $user->username(), 'resendActivation' => 1), false); //add error: invalid or expired hash $invalid['Account'] = l('activation.fail.invalid.hash');