Sorry for the 2 issue thing.
Here is a partial patch for you.
I suggest you add "*" as an indication you want to add to all the groups the user is a member of, that becomes quite powerful (you can use it in a command to mailhandler and get things into the right group)
I also suggest supporting og_user_roles.
The code here is not complete - it should be guarded, but I'm not sure if you want to re-write the whole access section, because I think you should be looking to see if the user has permission to create a node of this type in the mentioned group...
However - it seems to me, that might happen anyway later in mailhandler?
Anyway, the point is, og_user_roles MIGHT provide this permission.... But - be careful, you dont want to enable posting in all groups simple because the user has permissions in one group......
Cheers
Mark.
cvs diff: Diffing .
Index: og_mailhandler.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og_mailhandler/og_mailhandler.module,v
retrieving revision 1.1.2.2
diff -r1.1.2.2 og_mailhandler.module
19,20c19,28
< if ( isset($node->og_groups) && is_array($node->og_groups) ) {
< $node->og_groups = array_combine($node->og_groups, $node->og_groups);
---
> if ( isset($node->og_groups) ) {
> if (is_array($node->og_groups) ) {
> $node->og_groups = array_combine($node->og_groups, $node->og_groups);
> } else {
> if ($node->og_groups == '*') {
> global $user;
> $groups = array_keys($user->og_groups);
> $node->og_groups = array_combine($groups, $groups);
> }
> }
21a30
>
49a59,60
> } else {
> $ugid=$gid;
56a68,72
> } else {
> global $user;
>
> og_set_group_context(node_load($ugid)); // we'll set the context as the last group we see.... Why not.
> og_user_roles_grant_roles($user, og_get_group_context());
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | og_user_roles.patch | 1.77 KB | deltab |
Comments
Comment #1
xurizaemonThanks. Can you please re-attach as a diff, rather than pasting into comment?
Comment #2
deltab commentedPatch is attached, however, it does not seem to work with errors:
"You must join at least one group before posting story"
"Node submission failure: validation error."
I have OG User Roles and OG Mandatory Group installed, and some types are set to post to a maximum of "n" nodes.