/** * Output a profile setting * syntax: {{ profilesetting($string, $name) }} * * @param string $string The variable * @param string $name The name of the setting * * @return string */ public static function profileSetting($string, $name) { $profile = FrontendProfilesModel::get((int) $string); if ($profile === false) { return ''; } // convert into array $profile = $profile->toArray(); // @remark I know this is dirty, but I couldn't find a better way. if (in_array($name, array('display_name', 'registered_on', 'full_url')) && isset($profile[$name])) { return $profile[$name]; } elseif (isset($profile['settings'][$name])) { return $profile['settings'][$name]; } else { return ''; } }
/** * Validate the form */ private function validateForm() { // is the form submitted if ($this->frm->isSubmitted()) { // get field $txtEmail = $this->frm->getField('email'); // field is filled in? if ($txtEmail->isFilled(FL::getError('EmailIsRequired'))) { // valid email? if ($txtEmail->isEmail(FL::getError('EmailIsInvalid'))) { // email exists? if (FrontendProfilesModel::existsByEmail($txtEmail->getValue())) { // get profile id using the filled in email $profileId = FrontendProfilesModel::getIdByEmail($txtEmail->getValue()); // get profile $profile = FrontendProfilesModel::get($profileId); // must be inactive if ($profile->getStatus() != FrontendProfilesAuthentication::LOGIN_INACTIVE) { $txtEmail->addError(FL::getError('ProfileIsActive')); } } else { // email don't exist $txtEmail->addError(FL::getError('EmailIsInvalid')); } } } // valid login if ($this->frm->isCorrect()) { // activation URL $mailValues['activationUrl'] = SITE_URL . FrontendNavigation::getURLForBlock('Profiles', 'Activate') . '/' . $profile->getSetting('activation_key'); // trigger event FrontendModel::triggerEvent('Profiles', 'after_resend_activation', array('id' => $profileId)); // send email $from = $this->get('fork.settings')->get('Core', 'mailer_from'); $replyTo = $this->get('fork.settings')->get('Core', 'mailer_reply_to'); $message = Message::newInstance(FL::getMessage('RegisterSubject'))->setFrom(array($from['email'] => $from['name']))->setTo(array($profile->getEmail() => ''))->setReplyTo(array($replyTo['email'] => $replyTo['name']))->parseHtml('/Profiles/Layout/Templates/Mails/Register.html.twig', $mailValues, true); $this->get('mailer')->send($message); // redirect $this->redirect(SITE_URL . $this->URL->getQueryString() . '?sent=true'); } else { $this->tpl->assign('resendActivationHasError', true); } } }