本文整理汇总了PHP中UserInfo::setStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP UserInfo::setStatus方法的具体用法?PHP UserInfo::setStatus怎么用?PHP UserInfo::setStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserInfo
的用法示例。
在下文中一共展示了UserInfo::setStatus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createUser
/**
* create the user
*/
function createUser()
{
// all data is already correct
$this->userName = $this->_request->getValue("userName");
$this->userFullName = $this->_request->getValue("userFullName");
$this->userPassword = $this->_request->getValue("userPassword");
$this->userEmail = $this->_request->getValue("userEmail");
$users = new Users();
$user = new UserInfo($this->userName, $this->userPassword, $this->userEmail, "", $this->userFullName);
// if user registration need email confirm, that is
// user must active his account
if ($this->need_confirm == true) {
$user->setStatus(USER_STATUS_UNCONFIRMED);
} else {
$user->setStatus(USER_STATUS_ACTIVE);
}
$userId = $users->addUser($user);
if (!$userId) {
$this->_view = new SummaryView("registererror");
$this->_view->setErrorMessage($this->_locale->tr("error_adding_user"));
$this->setCommonData(true);
return false;
}
return $userId;
}
示例2: perform
function perform()
{
// fetch the validated data
$this->_userName = Textfilter::filterAllHTML($this->_request->getValue("userName"));
$this->_userPassword = $this->_request->getValue("newUserPassword");
$this->_userEmail = Textfilter::filterAllHTML($this->_request->getValue("userEmail"));
$this->_userFullName = Textfilter::filterAllHTML($this->_request->getValue("userFullName"));
$this->_userStatus = $this->_request->getValue("userStatus");
$this->_userBlog = $this->_request->getValue("userBlog");
// now that we have validated the data, we can proceed to create the user, making
// sure that it doesn't already exists
$users = new Users();
$userInfo = $users->userExists($this->_userName);
if ($userInfo) {
$this->_form->setFieldValidationStatus("userName", false);
$this->_view = new AdminAddUserView($this->_blogInfo);
$this->setCommonData(true);
return false;
}
// otherwise, we can create a new one
$user = new UserInfo($this->_userName, $this->_userPassword, $this->_userEmail, "", $this->_userFullName, 0, $this->_properties);
$user->setStatus($this->_userStatus);
$this->notifyEvent(EVENT_PRE_USER_ADD, array("user" => &$user));
$newUserId = $users->addUser($user);
if (!$newUserId) {
$this->_view = new AdminAddUserView($this->_blogInfo);
$this->_form->setFieldValidationStatus("userName", false);
$this->setCommonData(true);
return false;
}
// if the userBlog parameter is different than 0, we have to add a relationship
// between that user and the blog
if ($this->_userBlog > 0) {
$permissions = new UserPermissions();
$result = $permissions->grantPermission($newUserId, $this->_userBlog, PERMISSION_BLOG_USER);
}
$this->notifyEvent(EVENT_POST_USER_ADD, array("user" => &$user));
$this->_view = new AdminSiteUsersListView($this->_blogInfo);
$this->_view->setSuccessMessage($this->_locale->pr("user_added_ok", $user->getUsername()));
$this->setCommonData();
return true;
}
示例3: UserInfo
/**
* Given a result record from a Execute call, it will fill in the
* fields of the object, so that we don't have to repeat the same
* code too many times
*/
function _fillUserInformation($query_result, $extraInfo = false)
{
$userInfo = new UserInfo($query_result["user"], $query_result["password"], $query_result["email"], $query_result["about"], $query_result["full_name"], $query_result["resource_picture_id"], unserialize($query_result["properties"]), $query_result["id"]);
if ($extraInfo) {
// load this data if explicitely required!
$userBlogs = $this->getUsersBlogs($userInfo->getId());
$userInfo->setBlogs($userBlogs);
}
// set some permissions
//$userInfo->setSiteAdmin($this->perms->isSiteAdmin( $userInfo->getId()));
$userInfo->setSiteAdmin($query_result["site_admin"]);
$userInfo->setStatus($query_result["status"]);
return $userInfo;
}