本文整理汇总了PHP中UserProfile::Load方法的典型用法代码示例。如果您正苦于以下问题:PHP UserProfile::Load方法的具体用法?PHP UserProfile::Load怎么用?PHP UserProfile::Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserProfile
的用法示例。
在下文中一共展示了UserProfile::Load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadFromUsername
public static function loadFromUsername($username)
{
$user = new UserProfile();
$user->Load("username ='" . $username . "'");
return $user;
}
示例2: act_edit_user
public function act_edit_user()
{
// var_dump($_POST);
include_once APPROOT . 'inc/lib_form.inc';
include_once APPROOT . 'inc/lib_form_util.inc';
include_once APPROOT . 'inc/lib_validate.inc';
include_once APPROOT . 'inc//security/lib_auth.inc';
include_once APPROOT . 'mod/admin/lib_user.inc';
$user_form = user_get_form();
unset($user_form['username']);
unset($user_form['role']);
unset($user_form['status']);
unset($user_form['password1']);
unset($user_form['password2']);
$this->user_form = $user_form;
//$user_form['username']['type'] = 'hidden';
//$user_form['username']['extra_opts']['value'] = $_SESSION['username'];
if (isset($_POST['save'])) {
$valide = true;
$username = $_SESSION['username'];
$firstName = $_POST['first_name'];
$lastName = $_POST['last_name'];
$organization = $_POST['organization'];
$designation = $_POST['designation'];
$email = $_POST['email'];
$address = $_POST['address'];
$locale = $_POST['locale'];
if (isset($email) && $email != '' && !shn_valid_email($email)) {
//email not valide
$user_form['email']['extra_opts'] = array();
$user_form['email']['extra_opts']['error'] = array();
$user_form['email']['extra_opts']['error'][] = _t("INVALID_EMAIL");
$valide = false;
}
$this->user_form = $user_form;
if ($valide == true) {
$user = new User();
$user = UserHelper::loadFromUsername($username);
//$user->loadUserProfile();
//$user->role = $role;
//$user->status = $status;
$cfg = array();
if (!empty($user->config)) {
$cfg = @json_decode($user->config, true);
}
$cfg['locale'] = $locale;
$user->config = json_encode($cfg);
$user->Save();
$userProfile = UserProfileHelper::loadFromUsername($username);
$userProfile->username = $username;
$userProfile->first_name = $firstName;
$userProfile->last_name = $lastName;
$userProfile->organization = $organization;
$userProfile->designation = $designation;
$userProfile->email = $email;
$userProfile->address = $address;
$userProfile->Save();
set_redirect_header('home', 'edit_user');
}
}
if (isset($_SESSION['username'])) {
$user = new User();
$userProfile = new UserProfile();
$username = $_SESSION['username'];
$user->Load("username='" . $username . "'");
$userProfile->Load("username='" . $username . "'");
//$user_form['username']['extra_opts']['value'] = $user->getUserName();
//$user_form['password1'] = null;
//$user_form['password2'] = null;
$user_form['first_name']['extra_opts']['value'] = $userProfile->getFirstName();
$user_form['last_name']['extra_opts']['value'] = $userProfile->getLastName();
$user_form['organization']['extra_opts']['value'] = $userProfile->getOrganization();
$user_form['designation']['extra_opts']['value'] = $userProfile->getDesignation();
$user_form['email']['extra_opts']['value'] = $userProfile->getEmail();
$user_form['address']['extra_opts']['value'] = $userProfile->getAddress();
//$user_form['role']['extra_opts']['value'] = $user->getUserType();
//$user_form['status']['extra_opts']['value'] = $user->status;
if (!empty($user->config)) {
$cfg = @json_decode($user->config, true);
if ($cfg['locale']) {
$user_form['locale']['extra_opts']['value'] = $cfg['locale'];
}
}
$this->user_form = $user_form;
}
$this->username = $username;
}