As you can see from this major performace issue #330135: menu_router_build call in hook_init is a serious performance hit, the really roadblock is og_content_type_admin_menu_alter is not getting called by drupal machinery when we need. Any attempt to make this work seem to add signficant performance penalties. So I am thinking may be hook_menu_alter is not the hook we want to use.
I am a newbie when comes to dabbling in code. so ignore me if my thoughts don't make any sense.
At a fundamental level this module is about "removing" access to create certain content types in a given group. I mean without this module all content types can be created in a group (provided they are group enabled) and this module removed that access. So we can use og_links_alter to remove the links to create those types. Which links to remove that logic can be still same.
Now this removes the links visually. A user can still type in /node/add/create_node_type link and create content that way. To prevent that we could use hook_form_alter (or hook_form_FORM_ID_alter) and prevent the form being submitted for those content type for groups. Again the logic for which group prevents what will remain same.
Any thoughts?
Comments
Comment #1
JamesK CreditAttribution: JamesK commentedBy using hook_og_links_alter() this module could also stop breaking og_block_details(). I don't see what the need is for overriding the entire block when you can instead just override specific links.
Comment #2
JamesK CreditAttribution: JamesK commentedComment #3
ajayg CreditAttribution: ajayg commentedI could be wrong here but I am suspecting there was a need in the past to override entire block since at that time OG didn't support theming og_block details or theming individual links.
But it is a moot point now and whatever we can simplify should be done now.
Comment #4
rismondo CreditAttribution: rismondo commentedSubscribing
Comment #5
turadg CreditAttribution: turadg commented+1 subscribe
Comment #6
Leeteq CreditAttribution: Leeteq commentedSubscribing.
Comment #7
jvieille CreditAttribution: jvieille commentedSubscribing -
Overriding the group detail block does not even seem to work for me.
Comment #8
Josh Benner CreditAttribution: Josh Benner commentedSnippet for your module (or for maintainer to use in og_content_type_admin):
A note to maintainer: you should probably make an API function that returns the status of all types for a given group NID.