/** * @inheritdoc */ public function run() { $friendshipsEnabled = Yii::$app->getModule('friendship')->getIsEnabled(); $countFriends = 0; if ($friendshipsEnabled) { $countFriends = Friendship::getFriendsQuery($this->user)->count(); } $countFollowing = $this->user->getFollowingCount(User::className()) + $this->user->getFollowingCount(Space::className()); $countUserSpaces = Membership::getUserSpaceQuery($this->user)->andWhere(['!=', 'space.visibility', Space::VISIBILITY_NONE])->andWhere(['space.status' => Space::STATUS_ENABLED])->count(); return $this->render('profileHeader', array('user' => $this->user, 'isProfileOwner' => $this->isProfileOwner, 'friendshipsEnabled' => $friendshipsEnabled, 'countFriends' => $countFriends, 'countFollowers' => $this->user->getFollowerCount(), 'countFollowing' => $countFollowing, 'countSpaces' => $countUserSpaces)); }
public function actionSpaceMembershipList() { $query = \humhub\modules\space\models\Membership::getUserSpaceQuery($this->getUser()); if (!$this->getUser()->isCurrentUser()) { $query->andWhere(['!=', 'space.visibility', \humhub\modules\space\models\Space::VISIBILITY_NONE]); } $title = Yii::t('UserModule.widgets_views_userSpaces', '<strong>Member</strong> in these spaces'); return $this->renderAjaxContent(\humhub\modules\space\widgets\ListBox::widget(['query' => $query, 'title' => $title])); }
/** * @inheritdoc */ public function run() { $query = Membership::getUserSpaceQuery($this->user)->andWhere(['!=', 'space.visibility', Space::VISIBILITY_NONE])->andWhere(['space.status' => Space::STATUS_ENABLED]); $showMoreLink = $query->count() > $this->maxSpaces; return $this->render('userSpaces', ['user' => $this->user, 'spaces' => $query->limit($this->maxSpaces)->all(), 'showMoreLink' => $showMoreLink]); }