Piwik\Plugins\UsersManager\API::userExists PHP Method

userExists() public method

Returns true if the given userLogin is known in the database
public userExists ( string $userLogin ) : boolean
$userLogin string
return boolean true if the user is known
    public function userExists($userLogin)
    {
        if ($userLogin == 'anonymous') {
            return true;
        }
        Piwik::checkUserIsNotAnonymous();
        Piwik::checkUserHasSomeViewAccess();
        if ($userLogin == Piwik::getCurrentUserLogin()) {
            return true;
        }
        return $this->model->userExists($userLogin);
    }

Usage Example

 private function userExistsInPiwik($login)
 {
     return $this->usersManagerAPI->userExists($login);
 }