Organic Groups Create Permissions

Written Steps
This is a members only video. Login or create a free account for instant access.
In this video we will decide who can post to a group, and what they can post to a group.

This is a members only video. Login or create a free account for instant access.
In this video we will decide who can post to a group, and what they can post to a group.
Comments
Hi there.
Hi there.
Thanks for the OG series, it helped me a lot, before that I couldn't even understand what OG was about : )
I have a question about the og_create_perms module that you show in the above video, and I hope this is the right place where to ask.
I have a content type (A) set as group type and another (B) set as group content. Since I was trying to have B posted only inside groups I set permissions this way:
In the usual permission page under "people" I set no permissions about B (so that users don't see the "add content->B" link in navigation), under "group general permissions" I enable the users to "create", "edit" and "delete" B.
Using panels I built a page to show the group and I use the "content create links" to show the "add" links.
But when I visit the group's page I can't see it.
Am I doing something wrong?
You're not doing anything wrong
You're not doing anything wrong. Last time I checked, in order for someone to be able to create content within a group, they must have the site wide permission first. You can work around this by requiring the group audience field for the content type, but I realize that's not always desirable. Another option is to disable the "add event" (or whatever) link in the Navigation menu, and create a "group create content menu" with the "add event" (and other group content types) link that is displayed within groups.
Thanks for the replay, I didn
Thanks for the replay, I didn't think about having the group audience as a required field, in my work case it would work perfectly. A much more simple solution.
Actually, you *can* create
Actually, you *can* create content within a group, even if you don't have general permissions to create that content type. The problem is that the og_create_perms implementation of hook_node_access uses og_get_context_by_url to determine access permissions. This means that it only works *on* the node/add page and not on the main group page (where you'd normally display the links to create content).
I had a more complex use case where I needed to allow different group roles to create different content types, so the above suggestions wouldn't work for me. I added the following to solve the problem:
function _node_access($node, $op, $account) {
$result = NODE_ACCESS_IGNORE;
if (is_string($node)) {
$type = $node;
$group = og_get_group('node', arg(1));
if (!$group) {
return $result;
}
}
else {
$type = $node->type;
}
if ($op == 'create' && in_array($type, og_create_perms_list_bundles())) {
if (!og_user_access($group->gid, 'create ' . $type . ' content', $account)) {
$access = false;
}
else {
$access = true;
}
if ($access) $result = NODE_ACCESS_ALLOW;
}
return $result;
}
This isn't 100% bullet-proof (as it only works on the group home page) but it's a pretty quick workaround that could easily be extended.
The same use case
Hi cfuller12,
I have the same use case, I mean, I have a "user" role who should be enabled to post articles to the group, and a "moderator" role who should be able to post articles and basic pages. Right now I'm unable to configure that I have tried in many ways according the tutorials, so I want to try your solution, but I'm new in Drupal so, I really don't know how to implement it. Could you give me a light to do that?
OG comments
Hi Brian,
Thanks so much for all your videos, they've helped me tons.
In my website, the idea is that each group has a number of discussions, just like Linkedin. It's also the idea that only group members can post and see those discussions.
The problem I have is that right now any site member can see the comments on any discussion. While the access to group discussions and group themselves is working perfectly, all comments are visible.
I tried adding group_audience as a field in comments, but this doesn't help, as I can't configure it so that the current project is selected by default.
I also tried adding field "Group content visibility" from bundle "Group Discussion comment" (group discussion is the name of the content type I created for group discussions), but I get the message "Field Group content visibility can only be attached to Node entity bundles.".
I'm lost at the moment and I'm not a developer so I have no idea where to go next. Would really appreciate your help.
Best,
Francisco
Hi Brian
Is there any way to do the same thing with Drupal 6.X ?
OG Create Permissions is only for Drupal 7.X right?
no longer needed ?
Am I wrong or OG create permissions is no longer needed as of OG >= 7.2.2, as "create" permission is already implemented by OG itself?
Thanks