Answer the question
In order to leave comments, you need to log in
Does Yii2 have a comment widget and a forum widget?
Good time everyone!
Does Yii2 have a ready made comments widget and a forum widget that could just be installed via composer?
Search for some reason did not return results ((
"maybe I'm a noob ((("
Answer the question
In order to leave comments, you need to log in
Well, firstly, it is more correctly called a module. A widget is something else.
https://yiigist.com/package/rmrevin/yii2-comments#...
In general, here is a very good site for extensions for yii and yii2.
https://yiigist.com/
PS There is a forum for the first version , maybe you can rewrite it for version 2.
These are the rules for rbac. If you do not use rbac, then in the module config just specify useRbac = false and ignore this block.
If you still need to use rbac, then you must have a script or migration that creates rbac rules, that's where you need to add these rules.
Good afternoon!
Please help on https://yiigist.com/package/rmrevin/yii2-comments#
where to write
<?php
use \rmrevin\yii\module\Comments\Permission;
use \rmrevin\yii\module\Comments\rbac\ItsMyComment;
$AuthManager = \Yii::$app->getAuthManager();
$ItsMyCommentRule = new ItsMyComment();
$AuthManager->add($ItsMyCommentRule);
$AuthManager->add(new \yii\rbac\Role([
'name' => Permission::CREATE,
'description' => 'Can create own comments',
]));
$AuthManager->add(new \yii\rbac\Role([
'name' => Permission::UPDATE,
'description' => 'Can update all comments',
]));
$AuthManager->add(new \yii\rbac\Role([
'name' => Permission::UPDATE_OWN,
'ruleName' => $ItsMyCommentRule->name,
'description' => 'Can update own comments',
]));
$AuthManager->add(new \yii\rbac\Role([
'name' => Permission::DELETE,
'description' => 'Can delete all comments',
]));
$AuthManager->add(new \yii\rbac\Role([
'name' => Permission::DELETE_OWN,
'ruleName' => $ItsMyCommentRule->name,
'description' => 'Can delete own comments',
]));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question