applications/dashboard/controllers/class.profilecontroller.php
public function GetUserInfo($UserReference = '', $Username = '', $UserID = '', $CheckPermissions = FALSE) {
      if ($this->_UserInfoRetrieved)
         return;
      
      if (!C('Garden.Profile.Public') && !Gdn::Session()->IsValid())
         throw PermissionException();
      
      // If a UserID was provided as a querystring parameter, use it over anything else:
      if ($UserID) {
         $UserReference = $UserID;
         $Username = 'Unknown'; // Fill this with a value so the $UserReference is assumed to be an integer/userid.
      }
         
      $this->Roles = array();
      if ($UserReference == '') {
         if ($Username) {
            $this->User = $this->UserModel->GetByUsername($Username);
         } else
            $this->User = $this->UserModel->GetID(Gdn::Session()->UserID);
      } elseif (is_numeric($UserReference) && $Username != '') {
         $this->User = $this->UserModel->GetID($UserReference);
      } else {
         $this->User = $this->UserModel->GetByUsername($UserReference);
      }
         
      if ($this->User === FALSE) {
         throw NotFoundException('User');
      } else if ($this->User->Deleted == 1) {
         Redirect('dashboard/home/deleted');
      } else {
         $this->RoleData = $this->UserModel->GetRoles($this->User->UserID);
         if ($this->RoleData !== FALSE && $this->RoleData->NumRows(DATASET_TYPE_ARRAY) > 0) 
            $this->Roles = ConsolidateArrayValuesByKey($this->RoleData->Result(), 'Name');
         
         if (Gdn::Session()->CheckPermission('Garden.Settings.Manage') || Gdn::Session()->UserID == $this->User->UserID) {
            $this->User->Transient = GetValueR('Attributes.TransientKey', $this->User);
         }

         // Hide personal info roles
         if (!CheckPermission('Garden.PersonalInfo.View')) {
            $this->Roles = array_filter($this->Roles, 'RoleModel::FilterPersonalInfo');
         }

         $this->SetData('Profile', $this->User);
         $this->SetData('UserRoles', $this->Roles);
         if ($CssClass = GetValue('_CssClass', $this->User)) {
            $this->CssClass .= ' '.$CssClass;
         }
      }
      
      if ($CheckPermissions && Gdn::Session()->UserID != $this->User->UserID)
         $this->Permission('Garden.Users.Edit');
      
      $this->AddSideMenu();
      $this->_UserInfoRetrieved = TRUE;
      return TRUE;
   }
public function GetUserInfo($UserReference = '', $Username = '', $UserID = '', $CheckPermissions = FALSE) {
      if ($this->_UserInfoRetrieved)
         return;
      
      if (!C('Garden.Profile.Public') && !Gdn::Session()->IsValid())
         throw PermissionException();
      
      // If a UserID was provided as a querystring parameter, use it over anything else:
      if ($UserID) {
         $UserReference = $UserID;
         $Username = 'Unknown'; // Fill this with a value so the $UserReference is assumed to be an integer/userid.
      }
         
      $this->Roles = array();
      if ($UserReference == '') {
         if ($Username) {
            $this->User = $this->UserModel->GetByUsername($Username);
         } else
            $this->User = $this->UserModel->GetID(Gdn::Session()->UserID);
      } elseif (is_numeric($UserReference) && $Username != '') {
         $this->User = $this->UserModel->GetID($UserReference);
      } else {
         $this->User = $this->UserModel->GetByUsername($UserReference);
      }
         
      if ($this->User === FALSE) {
         throw NotFoundException('User');
      } else if ($this->User->Deleted == 1) {
         Redirect('dashboard/home/deleted');
      } else {
         $this->RoleData = $this->UserModel->GetRoles($this->User->UserID);
         if ($this->RoleData !== FALSE && $this->RoleData->NumRows(DATASET_TYPE_ARRAY) > 0) 
            $this->Roles = ConsolidateArrayValuesByKey($this->RoleData->Result(), 'Name');
         
         if (Gdn::Session()->CheckPermission('Garden.Settings.Manage') || Gdn::Session()->UserID == $this->User->UserID) {
            $this->User->Transient = GetValueR('Attributes.TransientKey', $this->User);
         }

         // Hide personal info roles
         if (!CheckPermission('Garden.PersonalInfo.View')) {
            $this->Roles = array_filter($this->Roles, 'RoleModel::FilterPersonalInfo');
         }

         $this->SetData('Profile', $this->User);
         $this->SetData('UserRoles', $this->Roles);
         if ($CssClass = GetValue('_CssClass', $this->User)) {
            $this->CssClass .= ' '.$CssClass;
         }
      }
      
      if ($CheckPermissions && Gdn::Session()->UserID != $this->User->UserID)
         $this->Permission('Garden.Users.Edit');
      
      $this->AddSideMenu();
      $this->_UserInfoRetrieved = TRUE;
      return TRUE;
   }
public function GetUserInfo ( $ UserReference = '' , $ Username = '' , $ UserID = '' , $ CheckPermissions = FALSE ) { if ( $ this -> _UserInfoRetrieved ) return ; if ( ! C ( 'Garden.Profile.Public' ) && ! Gdn :: Session ( ) -> IsValid ( ) ) throw PermissionException ( ) ; // If a UserID was provided as a querystring parameter, use it over anything else: if ( $ UserID ) { $ UserReference = $ UserID ; $ Username = 'Unknown' ; // Fill this with a value so the $UserReference is assumed to be an integer/userid. } $ this -> Roles = array ( ) ; if ( $ UserReference == '' ) { if ( $ Username ) { $ this -> User = $ this -> UserModel -> GetByUsername ( $ Username ) ; } else $ this -> User = $ this -> UserModel -> GetID ( Gdn :: Session ( ) -> UserID ) ; } elseif ( is_numeric ( $ UserReference ) && $ Username != '' ) { $ this -> User = $ this -> UserModel -> GetID ( $ UserReference ) ; } else { $ this -> User = $ this -> UserModel -> GetByUsername ( $ UserReference ) ; } if ( $ this -> User === FALSE ) { throw NotFoundException ( 'User' ) ; } else if ( $ this -> User -> Deleted == 1 ) { Redirect ( 'dashboard/home/deleted' ) ; } else { $ this -> RoleData = $ this -> UserModel -> GetRoles ( $ this -> User -> UserID ) ; if ( $ this -> RoleData !== FALSE && $ this -> RoleData -> NumRows ( DATASET_TYPE_ARRAY ) > 0 ) $ this -> Roles = ConsolidateArrayValuesByKey ( $ this -> RoleData -> Result ( ) , 'Name' ) ; if ( Gdn :: Session ( ) -> CheckPermission ( 'Garden.Settings.Manage' ) || Gdn :: Session ( ) -> UserID == $ this -> User -> UserID ) { $ this -> User -> Transient = GetValueR ( 'Attributes.TransientKey' , $ this -> User ) ; } // Hide personal info roles if ( ! CheckPermission ( 'Garden.PersonalInfo.View' ) ) { $ this -> Roles = array_filter ( $ this -> Roles , 'RoleModel::FilterPersonalInfo' ) ; } $ this -> SetData ( 'Profile' , $ this -> User ) ; $ this -> SetData ( 'UserRoles' , $ this -> Roles ) ; if ( $ CssClass = GetValue ( '_CssClass' , $ this -> User ) ) { $ this -> CssClass .= ' ' . $ CssClass ; } } if ( $ CheckPermissions && Gdn :: Session ( ) -> UserID != $ this -> User -> UserID ) $ this -> Permission ( 'Garden.Users.Edit' ) ; $ this -> AddSideMenu ( ) ; $ this -> _UserInfoRetrieved = TRUE ; return TRUE ; }
Retrieve the user to be manipulated. Defaults to current user.

@since 2.0.0
@access public
@param mixed $User Unique identifier, possibly username or ID.
@param string $Username.
@param int $UserID Unique ID.
@param bool $CheckPermissions Whether or not to check user permissions.
@return bool Always true.
Retrieve the user to be manipulated . Defaults to current user .