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


PHP UsersPeer::updateUser方法代码示例

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


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

示例1: init

 public function init()
 {
     parent::init();
     // Verify we're on the correct database
     //print_r(coreConfig::get('database_connection'));exit;
     $connectionInfo = coreConfig::get('database_connection');
     $this->verbose("Using database: %s", $connectionInfo['database']);
     $username = trim($this->getOption('u'));
     $raw_password = trim($this->getOption('p'));
     if (empty($username) || empty($raw_password)) {
         $this->throwError('Username or password is empty.');
     }
     $userid = UsersPeer::getUserId($username);
     if (false === $userid) {
         $this->throwError('User named "%s" not found.', $username);
     }
     $this->verbose("Userid: %s", $userid);
     $this->verbose("Set password to: %s", $raw_password);
     // update user record
     if (false === UsersPeer::updateUser($userid, array('raw_password' => $raw_password))) {
         $this->throwError('Could not update user "%s" (userid %s)', $username, $userid);
     }
     // only with linked PunBB forum
     if ($this->args->flag('forum')) {
         if (coreConfig::get('app_path_to_punbb') !== null) {
             PunBBUsersPeer::setPassword($username, $raw_password);
         } else {
             $this->throwError('Forum password: "app_path_to_punbb" is not defined in environment "%s"', CORE_ENVIRONMENT);
         }
     }
     $this->verbose('Success!');
 }
开发者ID:krisodb,项目名称:RevTK,代码行数:32,代码来源:setpassword.php

示例2: updateUser

 /**
  * Updates any column data for given user id.
  *
  * 'raw_password' will be hashed as required and stored into 'password' column.
  * 
  * @param int   $userid
  * @param array $data 
  * @return boolean
  */
 private function updateUser($userid, $data)
 {
     if (isset($data['raw_password'])) {
         $data['password'] = coreContext::getInstance()->getUser()->getSaltyHashedPassword($data['raw_password']);
         unset($data['raw_password']);
     }
     if (false === UsersPeer::updateUser($userid, $data)) {
         $this->throwError('Could not update user id %s', $userid);
     }
     return true;
 }
开发者ID:nikitakit,项目名称:RevTK,代码行数:20,代码来源:setpassword.php

示例3: executeEdit

 /**
  * Edit Account
  *
  */
 public function executeEdit($request)
 {
     if ($request->getMethod() != coreRequest::POST) {
         // fill in form with current account details
         $userdata = $this->getUser()->getUserDetails();
         $formdata = array('username' => $userdata['username'], 'location' => $userdata['location'], 'email' => $userdata['email'], 'timezone' => $userdata['timezone']);
         $request->getParameterHolder()->add($formdata);
     } else {
         $validator = new coreValidator($this->getActionName());
         if ($validator->validate($request->getParameterHolder()->getAll())) {
             $userdata = array('email' => trim($request->getParameter('email')), 'location' => trim($request->getParameter('location', '')), 'timezone' => (double) trim($request->getParameter('timezone')));
             if (UsersPeer::updateUser($this->getUser()->getUserId(), $userdata)) {
                 $this->redirect('profile/index');
             }
         }
     }
 }
开发者ID:nikitakit,项目名称:RevTK,代码行数:21,代码来源:actions.php

示例4: changePassword

 /**
  * Update the user password in the main site and forum databases.
  * 
  * @param string $user
  * @param string $raw_password
  */
 public function changePassword($username, $raw_password)
 {
     $user_id = UsersPeer::getUserId($username);
     $columns = array('raw_password' => $raw_password);
     UsersPeer::updateUser($user_id, $columns);
     // set new password on forum account (not in staging)
     if (coreContext::getInstance()->getConfiguration()->getEnvironment() !== 'staging') {
         // only with linked PunBB forum
         if (coreConfig::get('app_path_to_punbb') !== null) {
             PunBBUsersPeer::updateUser($username, $columns);
         }
     }
 }
开发者ID:krisodb,项目名称:RevTK,代码行数:19,代码来源:rtkUser.php


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