当前位置: 首页>>代码示例>>PHP>>正文


PHP sfGuardUser::getProfile方法代码示例

本文整理汇总了PHP中sfGuardUser::getProfile方法的典型用法代码示例。如果您正苦于以下问题:PHP sfGuardUser::getProfile方法的具体用法?PHP sfGuardUser::getProfile怎么用?PHP sfGuardUser::getProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfGuardUser的用法示例。


在下文中一共展示了sfGuardUser::getProfile方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getUserMarkup

 static function getUserMarkup(sfGuardUser $user)
 {
     if (!$user->id) {
         throw new Exception("Can't get note markup for new user");
     }
     return '@' . $user->getProfile()->public_name;
 }
开发者ID:silky,项目名称:littlesis,代码行数:7,代码来源:NoteTable.class.php

示例2: executeApply

 public function executeApply()
 {
     $request = $this->getRequest();
     $this->form = new RegisterForm();
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         $this->form->bind($request->getParameter('register'));
         if ($this->form->isValid()) {
             mysfLog::log($this, "DEBUG: " . print_r($this->form->getValues(), TRUE));
             $this->form_ref =& $this->form;
             $username = $this->form->getValue('email');
             $password = $this->form->getValue('password');
             $sfGuardUser = new sfGuardUser();
             $sfGuardUser->setUsername($username);
             $sfGuardUser->setPassword($password);
             // Not until confirmed
             $sfGuardUser->setIsActive(false);
             $profile = $sfGuardUser->getProfile();
             $sfGuardUser->save();
             // save sfGuardUser before we populate the user profile because we need the user id
             $this->myPopulateProfileSettings($profile, $sfGuardUser);
             $profile->save();
             // Email start
             $opts = array();
             $opts['from_name'] = sfConfig::get('app_mail_fromname', "Spectralmind");
             $opts['from_email'] = sfConfig::get('app_mail_from', "office@spectralmind.com");
             $opts['parameters'] = array('validate' => $profile->getValidate());
             $opts['body_is_partial'] = true;
             $opts['to_name'] = $profile->getName();
             $opts['to_email'] = $profile->getEmail();
             $opts['subject'] = sfConfig::get('app_mail_subjectconfirmmail', "Confirm your registration");
             //$opts['html'] = "sendValidateNew";
             $opts['text'] = "sendValidateNew";
             /*
             				 // Or to use the Echo Logger
             				 $logger = new Swift_Plugins_Loggers_EchoLogger();
             				 $this->getMailer()->registerPlugin(new Swift_Plugins_LoggerPlugin($logger));
             				 * */
             $numSent = smintMailHelper::mail($opts);
             // not sent? react accordingly
             if ($numSent != 1) {
                 mysfLog::log($this, "ERROR: confirmation email not sent. Return value was {$numSent}");
                 return 'Error';
             }
             mysfLog::log($this, "DEBUG: Confirm link:" . url_for("sfApply/confirm?validate=" . $profile->getValidate(), true));
             return 'After';
         }
     }
 }
开发者ID:EQ4,项目名称:smint,代码行数:48,代码来源:actions.class.php

示例3: executeSignin

 /**
  * This is a symfony workaround. As soon as someone logs in check if they are in the DB.
  * If they aren't just insert them so they can authenticate.
  *
  * @param sfWebRequest $request
  */
 public function executeSignin($request)
 {
     if ($request->isMethod("post")) {
         $form = new sfGuardFormSignin();
         $username = $request->getParameter($form->getName() . "[username]");
         $c = new Criteria();
         $c->add(sfGuardUserPeer::USERNAME, $username);
         $res = sfGuardUserPeer::doCount($c);
         // if they dont exist in the db then stick them in so LDAP works
         if ($res == 0) {
             $u = new sfGuardUser();
             $u->setUsername($username);
             $u->save();
             $u->getProfile();
         }
     }
     parent::executeSignin($request);
 }
开发者ID:adatta02,项目名称:comp190-code,代码行数:24,代码来源:actions.class.php

示例4: executeApply

 public function executeApply()
 {
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         $username = $this->getRequestParameter('username');
         $password = $this->getRequestParameter('password');
         $sfGuardUser = new sfGuardUser();
         $sfGuardUser->setUsername($username);
         $sfGuardUser->setPassword($password);
         // Not until confirmed
         $sfGuardUser->setIsActive(false);
         $profile = $sfGuardUser->getProfile();
         $this->populateProfileSettings($profile);
         $sfGuardUser->save();
         $profile->save();
         $this->setFlash('sfApplyPlugin_id', $sfGuardUser->getId(), false);
         $this->sendEmail('sfApply', 'sendValidate');
         return 'After';
     }
 }
开发者ID:EQ4,项目名称:smint,代码行数:19,代码来源:BasesfApplyActions.class.php

示例5: executeRegister

 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('sgrove@berkeley.edu');
     /*
     $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, 'admin@cothink.dyndns.org');
     $mailer->disconnect();
     $this->logMessage("Email confirmation sent");
     //return sfView:: SUCCESS;
     */
     //return $this->redirect('user/pleaseConfirm?user='.urlencode($this->user['Username']));
     return $this->redirect("@show_user_profile?user=" . $profile->getUuid());
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:73,代码来源:actions.class.php

示例6: getUserProfileProperty

 /**
  * Gets a property of the profile of the user
  *
  * @param sfGuardUser $user
  * @param string $property_name
  * @return mixed
  * @author fabriceb
  * @since 2009-05-17
  */
 public function getUserProfileProperty($user, $property_name)
 {
     $getPropertyMethod = 'get' . $this->getProfilePhpName($property_name);
     if ($user) {
         return $user->getProfile()->{$getPropertyMethod}();
     } else {
         return null;
     }
 }
开发者ID:ner0tic,项目名称:scss,代码行数:18,代码来源:sfFacebookPropelGuardAdapter.class.php

示例7: getUserProfileProperty

 /**
  * Gets a property of the profile of the user
  *
  * @param sfGuardUser $user
  * @param string $property_name
  * @return mixed
  * @author fabriceb
  * @since 2009-05-17
  */
 public function getUserProfileProperty($user, $property_name)
 {
     $property_name = $this->getFieldName($property_name);
     return $user->getProfile()->{$property_name};
 }
开发者ID:kevindew,项目名称:sfFacebookConnectPlugin,代码行数:14,代码来源:sfFacebookDoctrineGuardAdapter.class.php

示例8: executeIdentification

 public function executeIdentification(sfWebRequest $request)
 {
     if (!$this->getUser()->isAuthenticated()) {
         $this->formInscription = new InscriptionForm();
         $class = sfConfig::get('app_sf_guard_plugin_signin_form', 'sfGuardFormSignin');
         $this->form = new $class();
         if ($request->ismethod('post')) {
             if ($request->getParameter('send') == "signin") {
                 $this->form->bind($request->getParameter('signin'));
                 if ($this->form->isValid()) {
                     $values = $this->form->getValues();
                     $this->getUser()->signin($values['user'], array_key_exists('remember', $values) ? $values['remember'] : false);
                     if ($this->getUser()->getAttribute('montantLocation')) {
                         $paypal = new PayPal();
                         $ret = $paypal->doExpressCheckout($this->getUser()->getAttribute('montantLocation'), 'Location de la voiture');
                         print_r($ret);
                     } else {
                         $this->redirect('espace_membre_profil');
                     }
                 }
             } else {
                 if ($request->getParameter('send') == "signup") {
                     $this->formInscription->bind($request->getParameter('signup'));
                     if ($this->formInscription->isValid()) {
                         $values = $this->formInscription->getValues();
                         //print_r($values);
                         //exit;
                         $user = new sfGuardUser();
                         $user->setEmailAddress($values['email_address']);
                         $user->setUsername($values['email_address']);
                         $user->setLastName($values['nom']);
                         $user->setFirstName($values['prenom']);
                         $user->setPassword($values['password1']);
                         $user->setIsActive(1);
                         $user->getProfile()->setAdresse($values['adresse']);
                         $user->getProfile()->setCodepostal($values['codepostal']);
                         $user->getProfile()->setVille($values['ville']);
                         $user->getProfile()->setFixe($values['fixe']);
                         $user->getProfile()->setMobile($values['mobile']);
                         $user->getProfile()->setDateNaissance($values['date_naissance']);
                         $user->getProfile()->setNumeroPermis($values['numero_permis']);
                         $user->getProfile()->setVilleDelivrance($values['ville_permis']);
                         $user->getProfile()->setPaysDelivrance($values['pays_permis']);
                         $user->getProfile()->setDateDelivrance($values['date_delivrance_permis']);
                         $user->getProfile()->setIsActivated(1);
                         $user->addGroupByName("client");
                         $user->save();
                         $this->getUser()->setAttribute('email_address', $values['email_address']);
                         $message = $this->getMailer()->compose(sfConfig::get('app_mail_saidi'), $values['email_address'], '[Mobilyrent] - Inscription Mobilyrent location de voiture', '[Mobilyrent] - Inscription Mobilyrent location de voiture');
                         $this->getMailer()->send($message);
                         //echo $this->getUser()->getAttribute('montantLocation');exit;
                         if ($this->getUser()->getAttribute('montantLocation')) {
                             $paypal = new PayPal();
                             $ret = $paypal->doExpressCheckout($this->getUser()->getAttribute('montantLocation'), 'Location de la voiture');
                             print_r($ret);
                         }
                         //$this->getUser()->setFlash('notice', sprintf('Inscription terminée.<br/>Un email vous a été envoyé. Connectez vous et continuer votre reservation.'));
                     }
                 }
             }
         }
     } else {
         $paypal = new PayPal();
         $ret = $paypal->doExpressCheckout($this->getUser()->getAttribute('montantLocation'), 'Location de la voiture');
         print_r($ret);
     }
 }
开发者ID:sfinx13,项目名称:appsmartproject,代码行数:67,代码来源:_actions.class.php

示例9: executeSignin

 public function executeSignin($request)
 {
     $this->op = $request->getParameter('op');
     //echo $this->op;
     //die;
     $dialog = $request->getParameter('dialog', false);
     /* IF FB CONNECT */
     if ($this->op == 'fbc' && ($facebook_uid = VoFacebook::getUid())) {
         //echo "FBC";die;
         $c = new Criteria();
         $c->addJoin(SfGuardUserProfilePeer::USER_ID, SfGuardUserPeer::ID);
         $c->add(SfGuardUserProfilePeer::FACEBOOK_UID, $facebook_uid);
         $sfGuardUser = SfGuardUserPeer::doSelectOne($c);
         if (!$sfGuardUser instanceof sfGuardUser) {
             // Comprobación de que no existe ya el usuario con ese username (bug #734)
             $c = new Criteria();
             $c->add(sfGuardUserPeer::USERNAME, 'Facebook_' . $facebook_uid);
             $existingUser = sfGuardUserPeer::doSelectOne($c);
             if ($existingUser) {
                 $existingUser->setUsername('Facebook_' . $facebook_uid . '-' . time());
                 $existingUser->save();
             }
             $sfGuardUser = new sfGuardUser();
             $sfGuardUser->setUsername('Facebook_' . $facebook_uid);
             $sfGuardUser->save();
             $voProfile = $sfGuardUser->getProfile();
             $vanityUrl = SfVoUtil::encodeVanity('Facebook_' . $facebook_uid);
             $voProfile->setFacebookUid($facebook_uid);
             if (!$voProfile->getNombre()) {
                 $data = VoFacebook::getData($voProfile->getFacebookUid());
                 $voProfile->setNombre($data->first_name);
                 $voProfile->setApellidos($data->last_name);
             }
             $c2 = new Criteria();
             $c2->add(SfGuardUserProfilePeer::VANITY, "{$vanityUrl}%", Criteria::LIKE);
             $usuariosLikeMe = SfGuardUserProfilePeer::doSelect($c2);
             $counter = 0;
             foreach ($usuariosLikeMe as $usuarioLikeMe) {
                 if (preg_match("/^Facebook_{$facebook_uid}-([0-9]*)/i", $usuarioLikeMe->getVanity(), $matches)) {
                     $curIdx = $matches[1];
                     if ($curIdx > $counter) {
                         $counter = $curIdx + 1;
                     }
                 } else {
                     $counter++;
                 }
             }
             $voProfile->setVanity("{$vanityUrl}" . ($counter == 0 ? '' : "-{$counter}"));
             $voProfile->setMailsComentarios(0);
             $voProfile->setMailsNoticias(0);
             $voProfile->setMailsContacto(0);
             $voProfile->setMailsSeguidor(0);
             $voProfile->save();
         }
         $this->getUser()->signin($sfGuardUser, false);
         $signinUrl = sfConfig::get('app_sf_guard_plugin_success_signin_url', $this->getUser()->getReferer('@homepage'));
         $this->redirect($signinUrl);
     }
     /* FI FB CONNECT */
     $this->registrationform = new RegistrationForm();
     $this->signinform = new SigninForm();
     if ($request->isMethod('post') && !$dialog) {
         // Register
         if ($this->op == 'r') {
             $this->registrationform = new RegistrationForm();
             $this->registrationform->bind($request->getParameter('registration'));
             if ($this->registrationform->isValid()) {
                 $user = new sfGuardUser();
                 $user->setUsername($this->registrationform->getValue('username'));
                 $user->setPassword($this->registrationform->getValue('password'));
                 $user->setIsActive(0);
                 $user->setCreatedAt(time());
                 $c = new Criteria();
                 $c->add(sfGuardUserPeer::USERNAME, $user->getUsername());
                 sfGuardUserPeer::doInsert($user);
                 $user = sfGuardUserPeer::doSelect($c);
                 if (count($user) == 1) {
                     $profile = $user[0]->getProfile();
                     $profile->setNombre($this->registrationform->getValue('nombre'));
                     $profile->setApellidos($this->registrationform->getValue('apellidos'));
                     $profile->setPresentacion($this->registrationform->getValue('presentacion'));
                     $profile->setAnonymous($this->registrationform->getValue('anonymous'));
                     $profile->setCodigo(util::generateUID());
                     /* Generar vanity */
                     if ($profile->getVanity() == '') {
                         $vanityUrl = SfVoUtil::encodeVanity($profile->getNombre() . "-" . $profile->getApellidos());
                         $c2 = new Criteria();
                         $c2->add(SfGuardUserProfilePeer::VANITY, "{$vanityUrl}%", Criteria::LIKE);
                         $c2->add(SfGuardUserProfilePeer::ID, $user[0]->getId(), Criteria::NOT_EQUAL);
                         $usuariosLikeMe = SfGuardUserProfilePeer::doSelect($c2);
                         $counter = 0;
                         foreach ($usuariosLikeMe as $usuarioLikeMe) {
                             $counter++;
                         }
                         $profile->setVanity("{$vanityUrl}" . ($counter == 0 ? '' : "-{$counter}"));
                     }
                     /* Fin Generar vanity */
                     sfGuardUserProfilePeer::doInsert($profile);
                     $this->sendWelcome($user[0]);
                     $this->user = $user[0];
//.........这里部分代码省略.........
开发者ID:voota,项目名称:voota,代码行数:101,代码来源:actions.class.php

示例10: ajouterUtilisateur

 public function ajouterUtilisateur($values)
 {
     $user = new sfGuardUser();
     $user->setEmailAddress($values['email_address']);
     $user->setUsername($values['email_address']);
     $user->setLastName($values['nom']);
     $user->setFirstName($values['prenom']);
     $user->setPassword($values['password1']);
     $user->setIsActive(1);
     $user->getProfile()->setAdresse($values['adresse']);
     $user->getProfile()->setCodepostal($values['codepostal']);
     $user->getProfile()->setVille($values['ville']);
     $user->getProfile()->setFixe($values['fixe']);
     $user->getProfile()->setMobile($values['mobile']);
     $user->getProfile()->setDateNaissance($values['date_naissance']);
     $user->getProfile()->setNumeroPermis($values['numero_permis']);
     $user->getProfile()->setVilleDelivrance($values['ville_permis']);
     $user->getProfile()->setPaysDelivrance($values['pays_permis']);
     $user->getProfile()->setDateDelivrance($values['date_delivrance_permis']);
     $user->getProfile()->setIsActivated(1);
     $user->addGroupByName("client");
     $user->save();
     $this->getUser()->setAttribute('email_address', $values['email_address']);
     return $user;
 }
开发者ID:sfinx13,项目名称:appsmartproject,代码行数:25,代码来源:actions.class.php


注:本文中的sfGuardUser::getProfile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。