Get owner attribute value. Logined user id by default.
@return mixed|null
978275
public function getDefaultOwnerAttributeValue()
    {
        if (Yii::$app->has('user')) {
            $userId = Yii::$app->get('user')->id;
            if ($userId === null) { // something wrong
                throw new InvalidValueException('Empty owner ID');
            }
            return $userId;
        }
    }
1333016
private function getUserId()
    {
        if (!$this->tokenProvider || null === ($token = $this->tokenProvider->getToken())) {
            return;
        }

        if (!$token->getUser() instanceof UserInterface) {
            return;
        }

        return $token->getUser()->getId();
    }
1024288
public function owner()
    {
        $userModel   = Config::get( 'teamwork.user_model' );
        $userKeyName = ( new $userModel() )->getKeyName();
        return $this->hasOne(Config::get('teamwork.user_model'), $userKeyName, "owner_id");
    }
718908
public function getAuthor()
    {
        $user = null;

        if($this->hasProperty('created_by') && !empty($this->created_by)) {
            $user = $this->getObject('user.provider')->getUser($this->created_by);
        }

        return $user;
    }
840267
public function getOwner()
    {
        if ($this->owner === null) {
            return null;
        }
        return $this->persistenceManager->getObjectByIdentifier($this->owner, $this->reflectionService->getDefaultImplementationClassNameForInterface(UserInterface::class));
    }
565440
protected function getUser()
    {
        if ($this->_user === null) {
            $this->_user = $this->getClient()->user;
        }
        return $this->_user;
    }
492293
public function getUser()
    {
        if ($this->_user === false) {
            foreach (Yii::$app->user->getLoginPriority() as $item) {
                if ($item::validate($this->id)) {
                    return $item::getUser($this->id);
                }
            }
        }

        return $this->_user;
    }
1254552
public function getUserId() {
		if (isset($_SESSION) && isset($_SESSION[self::SESSION_FIELD_USER_ID])) {
			return $_SESSION[self::SESSION_FIELD_USER_ID];
		}
		else {
			return null;
		}
	}
1332534
public function getUserInRequest() {
    if (isset($_COOKIE[$this->cookieName])) {
      $user = $this->validateToken($_COOKIE[$this->cookieName],
          $this->clientId);
      if ($user) {
        $accountInfo = $this->getUserById($user->getUserId());
        $accountInfo->setProviderId($user->getProviderId());
        return $accountInfo;
      }
    }
    return null;
  }
1259329
public function owner()
    {
        $iReturn = 0;

        foreach ($this->getMembers() as $iId => $aMember) {
            if (1 == $aMember['owner']) {
                $iReturn = $iId;
                break;
            }
        }

        return $iReturn;
    }
1133587
public function getUser()
    {
        if (empty($this->obHelper)) {
            return null;
        }

        $sAuthFacadeClass = $this->obHelper->getAuthFacade();

        return $sAuthFacadeClass::getUser();
    }
1304019
public function getAuthorNameAttribute()
    {
        $attribute = config('forum.integration.user_name');

        if (!is_null($this->author)) {
            return $this->author->$attribute;
        }

        return null;
    }
479589
public function getRoot()
    {
        if ( $this->owner->{$this->parentIdField} ) {
            return Yii::$app->db->cache(function(){
                return call_user_func("$this->ownerClassName::findOne", current($this->getParentsId()));
            }, null, $this->getTagDependency());
        } else {
            return $this->owner;
        }
    }
1308492
protected function getUserId()
    {
        if (Credentials::check()) {
            return Credentials::getUser()->id;
        } elseif (isset($this['user_id']) && $this['user_id']) {
            return $this['user_id'];
        }
    }
832996
public function user() {
		$user = (int) $this->request->param('ID');
		
		$since = $this->owner->getRequest()->getVar('since');
		$offset = (int) $this->owner->getRequest()->getVar('before');
		if (!$offset) {
			$offset = false;
		}
		$filter = array('OwnerID' => $user);
		$tags = $this->getFilterTags();
		$target = $this->getTargetFilter();
		if ($target) {
			$filter['Target'] = $target;
		}
		
		$sort = $this->request->getVar('sort');
		if (!$sort) {
			$sort = 'ID';
		}
		
		
		$data = $this->owner->microBlogService->getStatusUpdates($filter, $sort, $since, $offset, $toplevel = true, $tags);
		
		$props = array(
			'Posts' => $data, 
			'Options' => $this->getOptions(),
			'QueryOffset'	=> $data->QueryOffset,
			'Target'		=> $target,
			'SortBy'		=> $sort
		);
		
		$timeline = trim($this->customise($props)->renderWith('Timeline'));

		if (Director::is_ajax()) {
			return $timeline;
		}

		$data = array(
			'Timeline'		=> '<strong>WARNING: USER VIEWS ARE IN ALPHA </strong>' . $timeline,
			'OwnerFeed'		=> $timeline,
		);

		return $this->customise($data)->renderWith(array('FullTimeline', 'Page'));
	}
437767
public function getOwnerUser()
    {
        $reflection = ClassUtils::newReflectionObject($this);

        if ($reflection->hasMethod('getUser')) {
            return $this->getUser();
        }
        elseif ($reflection->hasMethod('getUserProfile')) {
            return $this->getUserProfile() ? $this->getUserProfile()->getUser() : null;
        }

        return null;
    }
478321
public function user()
    {
        if (!is_null($this->user)) {
            return $this->user;
        }
        $user = null;
        try {
            $resourceId = Authorizer::getResourceOwnerId();
            $resourceType = Authorizer::getResourceOwnerType();
        } catch (\Exception $e) {
            $resourceId = null;
            $resourceType = null;
            // throw $e;
        }
        if ($resourceType !== $this->id) {
            return null;
        }
        if (!empty($resourceId)) {
            $user = $this->getProvider()->retrieveById($resourceId);
        }
        return $this->user = $user;

    }