I understand that subgroups are basically groups that have some sort of subgroup designation.
But, what about a "Create Subgroup" link? Is this even possible since there is no "subgroup" content type?
What I'm thinking, specifically, is Group Menu link titled "Create Subgroup" (requiring a "create subgroup" permission) that would create a subgroup of the group you are currently in. With my og user roles module, one could then give a user the ability to create subgroups within a particular group.
Just an idea that would be really cool. I guess the issues are:
a) How to get a create content link on navigation menu for subgroups when subgroups isn't a content type, and:
b) How to create a permission to access this link.
c) How to make the link actually pull up a form that will create a group tagged as a subgroup of the current group?
Sound like a good idea? Possible?
Comments
Comment #1
somebodysysop commentedActually, I sat down and figured out mostly everything.
Using hook_node_info I can actually create a "Subgroup" node type.
Using hook_perm I can define the permission to "create" this node type.
Using hook_access I actually get a "Create Subgroup" option to appear on the group menu.
Now, I just need to figure out how (when clicking on this link) to call up a group node creation form that forces a particular group (the current group context, also supplied in the link url) as the parent group.
Anyone know how to do this?
Comment #2
somebodysysop commentedI'm thisclose. I figured out that I could use hook_nodeapi('submit') to process the new group node just before it is saved to the database.
All I have to do is enter a record into og_ancestry that says that the group I am saving is a subgroup. I've created code to do this, and everything works except the db_query to save the og_ancestry record. I see the correct data from all the watchdogs (I've removed them here to make the code cleaner), but db_query just won't execute. Can anybody tell me why?
Comment #3
somebodysysop commentedWhoops. Sorry.
Placed the nodeapi code under case 'insert', and it works perfectly.
I now have a mechanism working in my og user roles module where I get a
"Create subgroup"
link on my OG group menu (if, of course, I have the correct permission). When I click on this link to create a subgroup, I get a node type group submission page. When I submit the page, the group is tagged as a subgroup of the group from which I clicked on "Create subgroup".
Cool!
Comment #4
(not verified) commentedComment #5
csc4 commentedI'm not quite clear why this was closed? Is this feature in 5.x-2.0 as I can't seem to find it.
I'm looking for something similar to this - I wanted to let users create groups but force the parent to a value and I think this is probably the way to do it? or is there a better way?
Comment #6
somebodysysop commentedCreating subgroups under groups is a feature I implemented on og_user_roles: http://drupal.org/project/og_user_roles
Comment #7
ezra-g commentedCommits were made recently that will allow OG_Subgroups to accept a gids= query string when creating\editing a subgroups. As far as providing these links, I believe this is a feature for the OG Content Type administration by Organic Group module or something that could be achieved by submitting a patch to Organic Groups allowing the Group Details block to be more customizable so that it displays "Create [content type]" links only for the desired content types. If such a feature is accepted to either of those two modules, they could perform a module_exists() check and read the possible parent group node types set in og_subgroups. Please see my old feature request at #148462: Restrict Content Types by OG Type.