public function executeRegister() { $campus = CampusPeer::retrieveByEmail($this->getRequestParameter('register_email')); $department = DepartmentPeer::retrieveByUuid($this->getRequestParameter('department')); //$subdepartment = SubdepartmentPeer::retrieveByName('cognitive neuroscience'); if ($campus == null) { $campus = CampusPeer::retrieveByEmail("@public"); $this->logMessage("Campus was null, now set to ({$campus})"); } $this->forward404Unless($campus, 'campus not found'); $this->forward404Unless($department, 'department not found'); //$this->forward404Unless($subdepartment, 'subdepartment not found'); $user = new sfGuardUser(); // TODO: Implement form validation in validate.yml $user->setUsername($this->getRequestParameter('register_email')); $user->setPassword($this->getRequestParameter('register_password')); $user->save(); $this->user = $user->toArray(); $this->logMessage('USER_ARRAY: ' . print_r($this->user, true)); $this->username = $this->user['Username']; $this->logMessage('USER_NAME_VAR: ' . $this->username); sfPropelApprovableBehavior::disable(); $this->getRequest()->setAttribute('user_id', $user->getId()); $this->logMessage('Set user_id in attributes: [' . $user->getId() . ']:[' . $this->getRequest()->getAttribute('user_id') . ']'); //$temp_email = $this->sendEmail('messages', 'confirmRegistrationEmail'); // Generate a UUID for the user profile, done upon saving it $profile = $user->getProfile(); $profile->setUserId($user->getId()); $profile->setCampusId($campus->getId()); $profile->setDepartmentId($department->getId()); $profile->setFirstName($this->getRequestParameter('first_name')); $profile->setLastName($this->getRequestParameter('last_name')); $profile->setNoPicture(); $profile->setTitle('student'); $profile->setGender(sfConfig::get('app_profile_unknown')); //$profile->setSubdepartmentId($subdepartment->getId()); $profile->save(); $profile->getPrimaryContactInfo(); $profile->addHistoryEvent($profile->getFullName() . ' has joined the Cothink community.', "We would like to welcome you to Cothink, we know you'll work to make the world a better place!"); $profile->addKarma(sfConfig::get('app_karma_join_site_points')); // $register_email = $this->sendEmail('messages', 'sendConfirmRegistrationEmail'); sfPropelApprovableBehavior::disable(); $this->user = sfGuardUserPeer::retrieveByUsername('*****@*****.**'); /* $this->logMessage("Sending email confirmation"); $conn = new Swift_Connection_SMTP( sfConfig::get('mod_sfswiftmailer_smtp_host', 'localhost') ); // Need auth for SMTP $conn->setUsername( sfConfig::get('mod_sfswiftmailer_smtp_user') ); $conn->setPassword( sfConfig::get('mod_sfswiftmailer_smtp_pass') ); $mailer = new Swift($conn); // Get our message bodies $htmlBody = $this->getPresentationFor('messages', 'confirmRegistrationHtml'); $textBody = $this->getPresentationFor('messages', 'confirmRegistrationText'); //Create a message $message = new Swift_Message("Thank you for joining the Cothink community. Please confirm your email address to complete registration."); //Add some "parts" $message->attach(new Swift_Message_Part($textBody)); $message->attach(new Swift_Message_Part($htmlBody, "text/html")); // Send out our mailer $mailer->send($message, $this->username, '*****@*****.**'); $mailer->disconnect(); $this->logMessage("Email confirmation sent"); //return sfView:: SUCCESS; */ //return $this->redirect('user/pleaseConfirm?user='******'Username'])); return $this->redirect("@show_user_profile?user=" . $profile->getUuid()); }