I'm trying to setup a bbpress with extended user capabilities.
The problem
My goal is that users need to have different capabilities in each forum, i.e:
- UserA can't access ForumW
- UserA can only read topics and replies in ForumX
- UserA can create topics and write replies in ForumY
- UserA can moderate ForumZ
Plugins
These are the plugins I tried so far, but without success:
Ultimate Member, official 1.7 and the new 2.0 version
https://ultimatemember.com/
They claim that they're working on a groups extension for UltimateMember v2, which somehow looks promising, but as of now there's no release date and I still don't know if this extension is going to solve my problem.itthinx Groups plugin
http://docs.itthinx.com/document/groups/
Allows me to assign multiple groups to users and forums, but there's still a catch.
First attempt
Since itthinx Groups plugin allows me to assign multiple groups to UserA, which is great, it's still not solving my issue.
So, I tried something like this:
ForumX has the following groups assigned:
ForumX_readers
,ForumX_writers
,ForumX_moderators
UserA has the following groups assigned:
ForumX_readers
,ForumY_writers
,ForumZ_moderators
But the problem is, since UserA belongs to groups that have publish_replies
and moderate
capabilities, he has full access to ForumX.
So what I need is an intersection of the forum-groups and the user-groups - which in this example is ForumX_readers
.
The promising part, but...
I digged into the code of the plugin and found the line that handles the capabilities of the user based on his assigned groups and quickly tried to get the current forum groups, to implement the intersection.
Unfortunatelly I was not able to access the global $post
, the $_GLOBALS['post']
nor the $_REQUEST[]
variables in this part of code. Neither directly nor with an apply_filters()
function, that I implemented into the part of the code myself.
UPDATE:
I was able to get the ID with get_posts()
and the slug of the current forum/topic.
So, my question
Is there any solution to my first attempt, which I may have overseen?
If not, is there maybe any other plugin that can solve my problem that I'm not aware of?
Or is something like that even impossible in bbpress?