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_BMax_B New
edited April 2007 in Vanilla 1.0 Help
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.
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; }
«1

Comments

  • I told you, this is alpha…
    I forgot the code to check and add the required new table column…
    Expect it tonight (CET).
  • Are you speaking about the following error:
    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?
  • Max_BMax_B New
    edited December 2006
    yep!
    You can add it manually if you like… or wait for 2 hours more.
  • Uploaded version 0.2.
    Database customization should be ok.
  • I get this error when I create a new category:
    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...
  • @Ø, Thanks for testing and reporting.

    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.
  • Sorry, I found another disperancy between my two version. Getting tired, I hope it's ok.
    Version 0.4 uploaded.
  • Well, now it seems to work fine. I've only re-tested what I already tested the first time, but all permissions are corresponding to what I've set and working :)
    I'll try it on another install this evening (it's 8:30 AM here) where I've more roles and categories.
  • I've set up Category Roles on my live forum, everything seems to work fine. I'm waiting for feedback from my users.

    Thanks for this very useful extension Max_B :)
  • max-b -- this extension is just what we've been looking for. We installed Category Roles on vanilla 1.01 with the psuedo theme and the necessary delegate addition. However, two additional category specific settings do not seem to have any effect on whether a user can start a new thread or post a comment to an existing thread -- I have both permissions set to "gatekeeper" and yet a "member" can still started new threads and comment on existing ones. Is there an interaction between role permissions and category ones that I'm not familiar with ? Any help on what might be causing this problem would be greatly appreciated -- eager to get this functionality.
  • @jmuramatsu:
    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.
  • Cannot create a new category:
    CategoryManager.SaveCategory();
    The error occurred on or near: Field 'Cat_filter' doesn't have a default value
  • @mary: if you are able to use phpMyAdmin, add a default, empty string, value to this text field in the LUM_Category table.
    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.
  • Max_B said:
    This default value case not showed on MySQL version I'm aware.
    I'm running MySQL 5, and if I recall correctly, it is much more picky about this type of thing than previous versions were.
  • As I'm on 5, I'll wait for your update to the package Max. Looking forward to trying this one out :)
  • Uploaded 0.5
    It should update smoothly upon previous unstallation.
  • I would LOVE to use this extension, but: I get an error while creating a new post, or while editing a category: Notice: unserialize(): Argument is not a string in /srv/www/vhosts/fast-lta.de/httpdocs/intern/fb/board/extensions/CategoryRoles/default.php on line 78 Any ideas? Thanks. (running 1.0.3)
  • Max_BMax_B New
    edited February 2007
    I'm away, for 3 more days. I'll fix this asap. In the meantime, you'll workaround by saving setting for each and every category, while ignoring the notice (a notice does not lead to failure of the page). This should initialize needed fields correctly.
  • @hannes.muc: before I dig in, did you install and activate the provided theme files?
  • edited March 2007
    Never mind, I am an idiot. Forgot to add the delegate stuff. After entering and saving, the warning messages no disappeared.
This discussion has been closed.