Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
[new extension] CategoryRoles ***REQUIRES A NEW DELEGATE***
Max_B
New
CategoryRoles
From the addon description:
Add a way to define distinct roles level for adding comment and opening a new discussion in a given category.
This extension adds two more, role based, category "level"; where Vanilla has 2:
• invisible/blocked : in Vanilla
• read-only
• read and add comment but no "open a new discussion"
• full access: in Vanilla
****NEEDS TWO MODIFIED THEME FILES****
A pseudo-theme is packed with the extension. See readme files.
Remarks
Edit: I forgot to mention in the readme: the roles are given increasing priority level from top to bottom. This extension uses this core priority ot set the required threshold. Adding a new role will probably imply revision of the categories settings.
As the title says, this extension requires a new delegate. As I don't know when/if Mark will be able to add it, I wrote instructions in the readme for the impatient to test it. See below.
Also, I want to remind that the extension paradigm has some flaws/limits and that to accomodate this paradigm the extension efficiency is sub-optimal.
And, lastly, this is alpha release…
From the readme:
This extension REQUIRES a specific delegate.
At the time of this writing (first release of the extension), you should add it yourself in the file /forum/library/Vanilla/Vanilla.Control.CategoryForm.php
There is only one line to add. In the excerpt below it's marked with the //CategoryRoles added delegate comment.
Presumably Mark will add it to future releases and this part of the readme be obsolete.
From the addon description:
Add a way to define distinct roles level for adding comment and opening a new discussion in a given category.
This extension adds two more, role based, category "level"; where Vanilla has 2:
• invisible/blocked : in Vanilla
• read-only
• read and add comment but no "open a new discussion"
• full access: in Vanilla
****NEEDS TWO MODIFIED THEME FILES****
A pseudo-theme is packed with the extension. See readme files.
Remarks
Edit: I forgot to mention in the readme: the roles are given increasing priority level from top to bottom. This extension uses this core priority ot set the required threshold. Adding a new role will probably imply revision of the categories settings.
As the title says, this extension requires a new delegate. As I don't know when/if Mark will be able to add it, I wrote instructions in the readme for the impatient to test it. See below.
Also, I want to remind that the extension paradigm has some flaws/limits and that to accomodate this paradigm the extension efficiency is sub-optimal.
And, lastly, this is alpha release…
From the readme:
This extension REQUIRES a specific delegate.
At the time of this writing (first release of the extension), you should add it yourself in the file /forum/library/Vanilla/Vanilla.Control.CategoryForm.php
There is only one line to add. In the excerpt below it's marked with the //CategoryRoles added delegate comment.
Presumably Mark will add it to future releases and this part of the readme be obsolete.
line 40
if ($this->PostBackAction == 'ProcessCategory') {
$this->Category = $this->Context->ObjectFactory->NewObject($this->Context, 'Category');
$this->Category->GetPropertiesFromForm($this->Context);
$Action = ($this->Category->CategoryID == 0) ? "SavedNew" : "Saved";
if (($this->Category->CategoryID > 0 && $this->Context->Session->User->Permission('PERMISSION_EDIT_CATEGORIES'))
|| ($this->Category->CategoryID == 0 && $this->Context->Session->User->Permission('PERMISSION_ADD_CATEGORIES'))) {
if ($this->CategoryManager->SaveCategory($this->Category)) {
$this->CallDelegate('PostSaveCategory'); //CategoryRoles added delegate
header('location: '.GetUrl($this->Context->Configuration, $this->Context->SelfUrl, '', '', '', '', 'PostBackAction=Categories&Action='.$Action));
}
} else {
$this->IsPostBack = 0;
}
0
This discussion has been closed.
Comments
I forgot the code to check and add the required new table column…
Expect it tonight (CET).
error while reading LUM_Category table from CategoryRoles extension SELECT CategoryID, Cat_filter FROM LUM_Category Unknown column 'Cat_filter' in 'field list'
...which occurs when trying to add or edit a category?
You can add it manually if you like… or wait for 2 hours more.
Database customization should be ok.
Notice: Undefined offset: 0 in ..\extensions\CategoryRoles\default.php on line 100 Notice: Undefined offset: 0 in ..\extensions\CategoryRoles\default.php on line 104
The extension seems to work, but not exactly as expected.
I had only one category, so I created a second category where I've set posting comments and starting discussions for administrators only.
--> Regular members were unable to start a new discussion, but can still add comments.
Then I created a third category where anybody can comment (unauthenticated selected in the first drop down menu) but ony administrators can start discussions.
--> Now when a regular member want to start a discussion, the only available choice is in this third category. Regular members can also add comments in all the three categories.
I tried selecting "Member" instead of "Unauthenticated" for each category, enabled and disabled the extension, but it still doesn't work properly. Maybe I've missed something in the configuration, I don't know...
The firsts notice on new category were due to a silly omission on ID=0 case.
Regarding the incorrect behaviour, it comes from an incorect modification i made while testing. I mixed up between my custom version and the public release.
Uploaded version 0.3.
Version 0.4 uploaded.
I'll try it on another install this evening (it's 8:30 AM here) where I've more roles and categories.
Thanks for this very useful extension Max_B
Did you check the roles order, in the "Roles & Permission" settings form?
The role are sorted in ascending priority order, so the "gatekeeper" role should be BELOW the "member" role in that list.
I'll add it to the code and upload a new release ASAP. This default value case not showed on MySQL version I'm aware.
It should update smoothly upon previous unstallation.