worstinme / yii2-forum
forum extension for yii 2
Installs: 134
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 5
Open Issues: 0
Type:yii2-extension
Requires
- worstinme/yii2-jodit: *
- worstinme/yii2-uikit: *
- yiisoft/yii2: >=2.0.6
- yiisoft/yii2-imagine: ~2.0.0
This package is not auto-updated.
Last update: 2025-01-04 21:03:18 UTC
README
forum extension for yii 2
Install
composer require --prefer-dist "worstinme/yii2-forum:dev-master"
Example settings
'forum' => [ 'class' => 'worstinme\forum\frontend\Module', 'languages'=>[ 'ru'=>'Русский', 'en'=>'English', ] ],
Route
- 'lang:(en|ru)/forum'=>'forum/default/index',
- 'lang:(en|ru)/forum/action:(section-create|forum-create|section-delete|forum-activate|forum-delete|section-activate)'=>'forum/default/',
- 'lang:(en|ru)/forum/action:(lock|new-thread|upload-image|file-browser|post-delete|delete|edit|reply)'=>'forum/threads/',
- 'lang:(en|ru)/forum/section:[\w\-]+'=>'forum/default/section',
- 'lang:(en|ru)/forum/section:[\w\-]+/forum:[\w\-]+'=>'forum/default/forum',
- 'lang:(en|ru)/forum/section:[\w\-]+/forum:[\w\-]+/<thread_id:\d+>'=>'forum/threads/view',
['pattern'=>'forum','route'=>'forum/default/index','defaults'=>['lang'=>'ru']],
['pattern'=>'forum/<action:(section-create|forum-create|section-delete|forum-activate|forum-delete|section-activate)>','route'=>'forum/default/<action>','defaults'=>['lang'=>'ru']],
['pattern'=>'forum/<action:(lock|new-thread|upload-image|file-browser|post-delete|delete|edit|reply)>','route'=>'forum/threads/<action>','defaults'=>['lang'=>'ru']],
['pattern'=>'forum/<section:[\w\-]+>','route'=>'forum/default/section','defaults'=>['lang'=>'ru']],
['pattern'=>'forum/<section:[\w\-]+>/<forum:[\w\-]+>','route'=>'forum/default/forum','defaults'=>['lang'=>'ru']],
['pattern'=>'forum/<section:[\w\-]+>/<forum:[\w\-]+>/<thread_id:\d+>','route'=>'forum/threads/view','defaults'=>['lang'=>'ru']],
Default settings
public $languages = ['en'=>'English']; public $postPageSize = 20; public $moderRole = 'admin'; public $profileModel = '\app\models\Profile'; public $profileModelUserColumn = 'id'; public $postEditDelay = 60*5; public $postDeleteDelay = 60*5; public $threadEditDelay = 60*5; public $threadDeleteDelay = 60*5; public $processLanguageSetting = true;
Profile model
<?php namespace app\models; use Yii; use himiklab\thumbnail\EasyThumbnailImage; class Profile extends \yii\db\ActiveRecord { public static function tableName() { return 'user'; } public function getUrl() { return ['/profile/user','id'=>$this->user_id,'lang'=>Yii::$app->language]; } public function getName() { return $this->name.' '.$this->surname; } public function getAvatarUrl() { return EasyThumbnailImage::thumbnailFileUrl(Yii::getAlias('@common').'/files'.$this->avatar, 160, 160, EasyThumbnailImage::THUMBNAIL_OUTBOUND); } public function getUrl() { return '#'; } }