Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+7 votes
670 views
in Plugins by
edited by

I already posted a comment here but figured to create a separate thread for it in light of getting more help from the community

The permission2categories enables you to set permission levels for your categories. Thanks to Gabe (@Pupi1985)The most updated version hosted at:

https://github.com/pupi1985/permission2categories/commits/master

The problem is that it works fine and hides the posts in the specific category to users with lower level permission, however it does not prevent them from posting in that category!

How to reproduce:

The lower level users can still see the category and can select it at the time of posting questions, but once they press submit and post their question in that category their question gets stored in the DB and at the same time becomes hidden to them. They should not be let to post in the upper level category in the first place

Would be nice to make this plugin bug free and add it to the list of working plugins

Q2A version: 1.8.5

1 Answer

+1 vote
by

Technically speaking, that was never part of the requirements. According to the original author of the plugin:

After installation, when you edit a category in the admin section you will notice a select box. Simply choose the permission level you would like to set and then all questions in that category will be hidden from users of lower level.

And that was it. If requirements are respected, by definition, there can't be a bug :)

Anyway, I've just published v1.1.2 with this feature. I was lazy enough not to test it much, so please, go ahead and test it yourself.

I've also added category-level privilege checks. To understand this, it works in the following way. Imagine this:

  • A user is a Registered user (basic level)
  • In a given category, they are promoted to Superadmin (only for that category!)
  • In the plugin, that category is set only to be accessed by Administrators+

In this context, the user will be able to view and post on that given category.

by
Not there yet, categories are still visible at the question post/edit page

only after the user presses submit question to those categories, gets this.

"You do not have permission to ask questions in this category"

Wouldn't be less confusing if the user could not see those categories at the drop down list at all?

Say there are 100 of categories why I should see all of them if I am only allowed to post on one or two?
by
edited by
2) this one is more of a question / observation and wonder if it should be like this
This plugin also forces the user to choose a category ! the super-admin can still post questions without choosing a category, but a registered user(or non-superadmin apparently) has no choice but to choose a category at the time of posting questions

Not calling it a bug, just short of consistency
by
1) Q2A provides a filter that runs at posting time. It doesn't really provide a hook on what categories are displayed.  It can be done with some additional JS coding. I would consider this as an improvement or a low priority bug, though. If someone wants to send a PR, I'd be happy to merge it

2) This one would be a bug, though. However, I can't reproduce this
by
if only we could filter the list of categories before being populated to the drop down list
by
To do that probably the category widget must be modified or as Pupi mentioned using javascript to hide.
...