public function actionUsers() { foreach (['muted', 'banned', 'group_id', 'title_id'] as $field) { if (isset($_POST[$field])) { ForumUser2Section::update($_POST['id'], [$field => $_POST[$field]]); Messages::get()->success("User saved!"); $this->goBack(); } } $model = ForumUser2Section::model(); $model->section_id = $this->sectionId; if (isset($_GET['ForumUser2Section'])) { $model->setAttributes($_GET['ForumUser2Section']); } $this->assign('model', $model); $this->assign('groups', ArrayHelper::get()->transform(ForumUserGroup::findAllBySection($this->sectionId), ['id' => 'full_name'])); $this->assign('titles', ArrayHelper::get()->transform(ForumTitle::findAll(), ['id' => 'title'])); }
?> <?php $menu = [['url' => $this->updateURLWithSection(['manage', 'groups']), 'label' => 'Manage Groups'], ['url' => $this->updateURLWithSection(['manage', 'categories']), 'label' => 'Manage Categories'], ['url' => $this->updateURLWithSection(['manage', 'users']), 'label' => 'Manage Users'], ['url' => $this->updateURLWithSection(['manage', 'titles']), 'label' => 'Manage Titles']]; } echo \app\components\htmltools\Page::get()->title(\mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['home', 'index']), $this->forumTitle) . " " . \mpf\modules\forum\components\Config::value('FORUM_PAGE_TITLE_SEPARATOR') . " Members", $menu); ?> <div class="forum-page <?php echo $this->forumPageTheme; ?> "> <?php $this->displayComponent('topuserpanel'); ?> <?php if ((!\mpf\modules\forum\components\UserAccess::get()->isMember($this->sectionId) || \mpf\modules\forum\components\UserAccess::get()->isBanned($this->sectionId)) && !\mpf\modules\forum\components\UserAccess::get()->isSiteModerator() && !\mpf\modules\forum\components\UserAccess::get()->isSiteAdmin()) { ?> <?php $this->displayComponent('accessdenied', ['location' => 'members']); ?> <?php return; ?> <?php } ?> <?php \mpf\widgets\datatable\Table::get(['dataProvider' => $model->getDataProvider($this->sectionId), 'columns' => ['user_id' => ['value' => '$row->getProfileLink()'], 'member_since' => ['class' => 'Date'], 'title_id' => ['value' => '$row->title_id?$row->title->title:"-"', 'filter' => \mpf\helpers\ArrayHelper::get()->transform(\mpf\modules\forum\models\ForumTitle::findAllByAttributes(['section_id' => $this->sectionId]), ['id' => 'title'])], 'group_id' => ['value' => '$row->group->full_name', 'filter' => \mpf\helpers\ArrayHelper::get()->transform(\mpf\modules\forum\models\ForumUserGroup::findAllBySection($this->sectionId), ['id' => 'full_name'])], 'muted' => ['class' => 'YesNo'], 'banned' => ['class' => 'YesNo']]])->display(); ?> </div>
public function updateGroupRights() { $allGroups = ForumUserGroup::findAllBySection($this->section_id); foreach ($this->groupRights as $groupId => $details) { $this->getDb()->table('forum_groups2categories')->insert(['group_id' => $groupId, 'category_id' => $this->id, 'admin' => (int) in_array('admin', $details), 'moderator' => (int) in_array('moderator', $details), 'newthread' => (int) in_array('newthread', $details), 'threadreply' => (int) in_array('threadreply', $details), 'canread' => (int) in_array('canread', $details)], ['admin' => (int) in_array('admin', $details), 'moderator' => (int) in_array('moderator', $details), 'newthread' => (int) in_array('newthread', $details), 'threadreply' => (int) in_array('threadreply', $details), 'canread' => (int) in_array('canread', $details)]); } foreach ($allGroups as $grp) { if (!isset($this->groupRights[$grp->id])) { $this->getDb()->table('forum_groups2categories')->insert(['group_id' => $grp->id, 'category_id' => $this->id, 'admin' => 0, 'moderator' => 0, 'newthread' => 0, 'threadreply' => 0, 'canread' => 0], ['admin' => 0, 'moderator' => 0, 'newthread' => 0, 'threadreply' => 0, 'canread' => 0]); } } }