Originally posted as an issue for OG module : http://drupal.org/node/1671084
The Group tab shows up for all content types, even though the content type is not associated with OG (i.e. it is not a group nor a group content). The tab is viewable by all users (non-auth, auth, admin etc.).
This only occurs when og_massadd is enabled.
If og_massadd is disabled, the Group tab disappears from all the different content types and only shows up on the group types (which is what it should do by default).
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | og_massadd-issue-1912848.patch | 1.14 KB | wadmiraal |
Comments
Comment #1
dan2k3k4 commentedThis occurs on the current dev release as well.
Comment #2
dan2k3k4 commentedFrom the issue posted on OG, this occurs for other OG sub-modules so I assume something changed in OG that the sub-modules haven't updated yet ?
Comment #3
nubeli commentedThe issue is centered on the hooks defined in og_ui.api.php. When the hooks are used without checks for whether the content type is a group they add the group tab to every content type.
In og_massadd.module I commented out the function og_massadd_og_ui_get_group_admin_alter() which eliminates the group tab issue. But that also removes any link to the new functionality so I also added og_massadd_og_ui_get_group_admin so links are added to the group admin tab. I borrowed from og_ui_og_ui_get_group_admin where before adding the links it runs og_user_access which returns NULL if it's not a group and FALSE if the user doesn't have access.
So that allows there to be links but doesn't add group tabs on every content type. Make sure to clear the cache if you update the module.
I haven't tried to figure out how to use og_massadd_og_ui_get_group_admin_alter() if that is needed. I'd welcome suggestions. Perhaps this code enough to make a patch.
Comment #4
jaxtheking commentedI realised I had the same issue when the "Administer Group" tab appeared for all users, even the ones that did not have any admin rights. Though the tab was an empty page and therefore not a security threat. But still... The below code should fix the issue.
I am not setup to create a patch now, but hopefully the module maintainer can test/add this easy fix.
At line 95 of og_massadd.module, replace the og_massadd_og_ui_get_group_admin_alter function with this:
Basically, this hijacks the add people link only when it exists.
Comment #5
fuzzy76 commentedHoping hernani can take a look at this? Our D7 platform won't be using Organic Groups, but multisite instead.
Comment #6
wadmiraal commentedTurned #3 into a patch.
Comment #7
namita21 commentedUsed #3 for removing group tab from all content type but that made Add people to go to default page not to the Group MassAdd page so added a condition mentioned in #4. All worked well.
Thanks for the help.
Comment #8
alvar0hurtad0Patch applyes and works fine.
Commited to dev version.
Comment #9
alvar0hurtad0