本文整理汇总了PHP中UserModel::updateUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModel::updateUser方法的具体用法?PHP UserModel::updateUser怎么用?PHP UserModel::updateUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModel
的用法示例。
在下文中一共展示了UserModel::updateUser方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateMissingData
public function updateMissingData($user, array $me)
{
$updateData = array();
if (empty($user['name'])) {
$updateData['name'] = $me['name'];
}
if (empty($user['fbuid'])) {
$updateData['fbuid'] = $me['id'];
}
if (!empty($updateData)) {
$this->userModel->updateUser($user, $updateData);
}
}
示例2: update
public function update($params)
{
if (!$this->checkSign($params)) {
return $this->response(0, array('errCode' => 'SIGN_ERROR', 'errInfo' => '签名错误'));
}
$userModel = new \UserModel();
$result = $userModel->updateUser();
return $this->response(1, $result);
}
示例3: updateAction
public function updateAction($param){
if($param == null)
$this->notFoundAction();
$opt = array( "title" => "Изменение профиля",
"content" => ($param == 0) ? "updatefile.tpl" : "updatetext.tpl");
$data = array();
$data["update"] = isset($_FILES["img"]) ? $_FILES["img"]["name"] : null;
if(!$data["update"])
$data["update"] = isset($_POST["update"]) ? $_POST["update"] : null;
$data["param"] = $param;
if($data["update"] == null){
if($param > 6 || $param < 0)
$this->notFoundAction();
$this->indexAction($opt, $data);
}
else{
$model = new UserModel();
$result = $model->updateUser($data, $this->_user["id"]);
if(in_array(false, $result))
$this->indexAction($opt, $data);
else
$this->profileAction();
}
}
示例4: checkUserLevel
/**
* 检查用户是否升级
* 升级时加150金币coins 1个购买的币reward_points
* @param $userinfo
*/
private function checkUserLevel($userinfo)
{
if (!$userinfo) {
return;
}
$level = $userinfo->level;
$experience = $userinfo->experience;
$model = new LevelModel();
$new_level = $model->getLevelByExp($experience);
if ($new_level != $level) {
$coins = $userinfo->coins + self::UPGRADE_ADD_COIN;
$reward_points = $userinfo->reward_points + self::UPGRADE_ADD_CASH;
$user = new UserModel();
$user->updateUser($this->uid, array('level' => $new_level, 'coins' => $coins, 'reward_points' => $reward_points));
$userinfo->level = $new_level;
$userinfo->coins = $coins;
$userinfo->reward_points = $reward_points;
unset($user);
}
return $userinfo;
}
示例5: updateMissingData
public function updateMissingData($user, stdClass $info)
{
if (empty($user['name'])) {
$this->userModel->updateUser($user, array('name' => $info->name));
}
}
示例6: foreach
try {
foreach ($objUser->selectUsers(array('email' => '*5@mail.ru'))->toArray() as $userArray) {
foreach ($userArray as $key => $val) {
echo " [" . $key . " = " . $val . "] ";
}
echo '<br>';
}
} catch (Exception $e) {
echo $e->getMessage() . '<br>';
}
echo '<br>' . "тест обновления пользователей" . '<br>';
try {
foreach ($objUser->selectUsers()->toArray() as $userArray) {
$newUserArray = array('nick' => $userArray['nick'] . " updated!", 'email' => '');
$id = $userArray[$arr['id']];
$objUser->updateUser($id, $newUserArray);
foreach ($objUser->selectUserByID($id)->toArray() as $key => $val) {
// получаем данные по ID
echo " [" . $key . " = " . $val . "] ";
}
echo '<br>';
}
} catch (Exception $e) {
echo $e->getMessage() . '<br>';
}
/*
echo '<br>' . "тест удаления пользователей" . '<br>';
try {
foreach($objUser->selectUsers()->toArray() as $userArray) {
$objUser->deleteUser($userArray[ $arr['id'] ]);
echo $userArray['login'] . " удален!" . '<br>';
示例7: upgradeDatabaseVersion20
//.........这里部分代码省略.........
accounts would work on switch
*/
$users[$i]["PASSWORD"] = $v20check;
$users[$i]["STATUS"] = INACTIVE_STATUS;
$users[$i]["CREATION_TIME"] = $creation_time;
$users[$i]["UPS"] = 0;
$users[$i]["DOWNS"] = 0;
$users[$i]["ZKP_PASSWORD"] = $zkp_password;
$i++;
}
unset($users[$i]);
$result = NULL;
}
}
$dbinfo = array("DBMS" => DBMS, "DB_HOST" => DB_HOST, "DB_USER" => DB_USER, "DB_PASSWORD" => DB_PASSWORD, "DB_NAME" => DB_NAME);
$profile_model->initializeSql($db, $dbinfo);
$database_tables = array_diff(array_keys($profile_model->create_statements), $save_tables);
$database_tables = array_merge($database_tables, array("BLOG_DESCRIPTION", "USER_OLD", "ACCESS"));
foreach ($database_tables as $table) {
if (!in_array($table, $save_tables)) {
$db->execute("DROP TABLE " . $table);
}
}
if ($profile_model->migrateDatabaseIfNecessary($dbinfo, $save_tables)) {
$user_model = new UserModel(DB_NAME, false);
$user_model->db = $db;
foreach ($users as $user) {
$user_model->addUser($user["USER_NAME"], $user["PASSWORD"], $user["FIRST_NAME"], $user["LAST_NAME"], $user["EMAIL"], $user["STATUS"], $user["ZKP_PASSWORD"]);
}
$user = array();
$user['USER_ID'] = ROOT_ID;
$user['PASSWORD'] = $v20check;
$user["ZKP_PASSWORD"] = $zkp_password;
$user_model->updateUser($user);
$db->execute("DELETE FROM VERSION WHERE ID < 19");
$db->execute("UPDATE VERSION SET ID=20 WHERE ID=19");
return;
}
$data['SCRIPT'] = "doMessage('<h1 class=\"red\" >" . "Couldn't migrate database tables from defaults!</h1>')";
case "1":
default:
?>
<!DOCTYPE html>
<html lang='en-US'>
<head>
<title>Yioop Upgrade Detected</title>
<meta name="ROBOTS" content="NOINDEX,NOFOLLOW" />
<meta name="Author" content="Christopher Pollett" />
<meta charset="utf-8" />
<?php
if (MOBILE) {
?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php
}
?>
<link rel="stylesheet" type="text/css"
href="<?php
e(BASE_URL);
?>
/css/search.css" />
</head>
<body class="html-ltr <?php
if (MOBILE) {
e('mobile');
}