本文整理汇总了PHP中UserClass::updateUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserClass::updateUser方法的具体用法?PHP UserClass::updateUser怎么用?PHP UserClass::updateUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserClass
的用法示例。
在下文中一共展示了UserClass::updateUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handler
function handler()
{
$messages = parent::handler();
$_USER = UserClass::getById($this->_FORMDATA["id"]);
if ($messages["status"] == "success" && !empty($this->_FORMDATA)) {
foreach ($this->_FORMDATA as $name => $value) {
if ($name == "email" && $value != $_USER->getProperty("email")) {
$user = UserClass::getByEmail($value);
if ($user !== false) {
$error_message[] = "Пользователь с таким email уже зарегистрирован";
}
} else {
if ($name == "login" && $value != $_USER->getProperty("login")) {
$user = UserClass::getByLogin($value);
if ($user !== false) {
$error_message[] = "Пользователь с таким логином уже зарегистрирован";
}
}
}
}
if ($error_message) {
$messages["status"] = "error";
$messages["error"] = $error_message;
unset($messages["success"]);
} else {
$arFields = array("id" => $this->_FORMDATA["id"], "login" => $this->_FORMDATA["login"], "email" => $this->_FORMDATA["email"], "full_name" => $this->_FORMDATA["full_name"], "pass" => $this->_FORMDATA["pass"], "active" => 1);
UserClass::updateUser($arFields);
$messages["success"] = "Информация обновлена.";
}
}
return $messages;
}
示例2: json_encode
<?php
/*****************************
Update user privileges
*****************************/
#start session
session_start();
#require required files
require '../../constants.php';
require '../../dbinfo.inc.php';
require '../../tools.php';
require '../../user.php';
$user_id = $_POST['user_id'];
$user_level = $_POST['user_level'];
$json_out = array();
$UserObject = new UserClass($user_id);
$UserObject->setLevel($user_level);
$json_out['update'] = $UserObject->updateUser();
#if no json yet (thus no error) -> succes!
if (is_null($json_out['update'])) {
$json_out = array('succes' => 'User privilege updated for ' . $UserObject->getUsername() . '.');
}
#output json
print json_encode($json_out);
示例3: UserClass
<?php
require '../Business/UserClass.php';
//build new article business object
$newUser = new UserClass($_POST['uUsername']);
$newUser->setId($_POST['editUserId']);
$newUser->setUsername($_POST['uUsername']);
$newUser->setFistName($_POST['uFirstname']);
$newUser->setLastName($_POST['uLastname']);
$newUser->setWordPass($_POST['uWordpass']);
$result = $newUser->updateUser();
//report success/failure
echo $result;