當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserProfile::Load方法代碼示例

本文整理匯總了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;
 }
開發者ID:GeraldScott,項目名稱:OpenEvSys,代碼行數:6,代碼來源:UserProfileHelper.php

示例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;
 }
開發者ID:GeraldScott,項目名稱:OpenEvSys,代碼行數:87,代碼來源:homeModule.class.php


注:本文中的UserProfile::Load方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。