public function searchByUser($userId)
    {
        $query = static::find();
        $query->where(['author_id' => $userId]);
        if (Podium::getInstance()->user->isGuest) {
            $query->joinWith(['forum' => function ($q) {
                $q->where([Forum::tableName() . '.visible' => 1]);
            }]);
        }

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'pagination' => false,
        ]);
        $dataProvider->sort->defaultOrder = [
            'updated_at' => SORT_DESC,
            'id' => SORT_ASC
        ];

        return $dataProvider;
    }
public function searchByUser($userId)
    {
        $query = static::find();
        $query->where(['author_id' => $userId]);
        if (Podium::getInstance()->user->isGuest) {
            $query->joinWith(['forum' => function ($q) {
                $q->where([Forum::tableName() . '.visible' => 1]);
            }]);
        }

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'pagination' => false,
        ]);
        $dataProvider->sort->defaultOrder = [
            'updated_at' => SORT_DESC,
            'id' => SORT_ASC
        ];

        return $dataProvider;
    }
public function searchByUser ( $ userId ) { $ query = static :: find ( ) ; $ query -> where ( [ 'author_id' => $ userId ] ) ; if ( Podium :: getInstance ( ) -> user -> isGuest ) { $ query -> joinWith ( [ 'forum' => function ( $ q ) { $ q -> where ( [ Forum :: tableName ( ) . '.visible' => 1 ] ) ; } ] ) ; } $ dataProvider = new ActiveDataProvider ( [ 'query' => $ query , 'pagination' => false , ] ) ; $ dataProvider -> sort -> defaultOrder = [ 'updated_at' => SORT_DESC , 'id' => SORT_ASC ] ; return $ dataProvider ; }
Searches for threads created by user of given ID.
@param int $userId
@return ActiveDataProvider
Searches for threads created by user of given ID .