/**
  */
 protected function initUserInstance()
 {
     if ($this->authorEntity instanceof ilObjUser && $this->authorEntity->getId()) {
         $this->author = $this->authorEntity;
     } else {
         if (is_numeric($this->authorEntity) && $this->authorEntity) {
             // Try to read user instance from preloaded cache array
             $this->author = ilForumAuthorInformationCache::getUserObjectById($this->authorEntity);
             if (!$this->author) {
                 // Get a user instance from forum module's cache method
                 $this->author = ilObjForumAccess::getCachedUserInstance($this->authorEntity);
             }
         }
     }
     if (!$this->author) {
         $this->author = new ilObjUser();
         $this->author->setId(0);
         $this->author->setPref('public_profile', 'n');
         $this->author->setGender('');
     }
 }
Ejemplo n.º 2
0
 private function getUserData()
 {
     global $lng;
     if ($this->id && $this->user_id) {
         require_once "Modules/Forum/classes/class.ilObjForumAccess.php";
         if ($tmp_user = ilObjForumAccess::getCachedUserInstance($this->user_id)) {
             $this->fullname = $tmp_user->getFullname();
             $this->loginname = $tmp_user->getLogin();
             unset($tmp_user);
         }
         $this->fullname = $this->fullname ? $this->fullname : ($this->import_name ? $this->import_name : $lng->txt('unknown'));
         return true;
     }
     return false;
 }