setError(t("please_enter_your_email_address", "Please enter your email address")); } elseif ($emailAddress != $emailAddressConfirm) { setError(t("your_email_address_confirmation_does_not_match", "Your email address confirmation does not match")); } elseif (!valid_email($emailAddress)) { setError(t("your_email_address_is_invalid", "Your email address is invalid")); } elseif (!strlen($username)) { setError(t("please_enter_your_preferred_username", "Please enter your preferred username")); } elseif (strlen($username) < 6 || strlen($username) > 20) { setError(t("username_must_be_between_6_and_20_characters", "Your username must be between 6 and 20 characters")); } else { $checkEmail = UserPeer::loadUserByEmailAddress($emailAddress); if ($checkEmail) { // username exists setError(t("email_address_already_exists", "Email address already exists on another account")); } else { $checkUser = UserPeer::loadUserByUsername($username); if ($checkUser) { // username exists setError(t("username_already_exists", "Username already exists on another account")); } } } // create the account if (!isErrors()) { $newPassword = createPassword(); $newUser = UserPeer::create($username, $newPassword, $emailAddress, $title, $firstname, $lastname); if ($newUser) { $subject = "Account details for " . SITE_CONFIG_SITE_NAME; $plainMsg = "Dear " . $firstname . ",\n\n"; $plainMsg .= "Your account on " . SITE_CONFIG_SITE_NAME . " has be created. Use the details below to login to your new account:\n\n"; $plainMsg .= "<strong>Url:</strong> <a href='" . WEB_ROOT . "'>" . WEB_ROOT . "</a>\n";