Use hook_og_links_alter() to remove content types from og group details block

ajayg - July 28, 2009 - 13:55
Project:Content Type Administration by Organic Group
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

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?

#1

JamesK - August 15, 2009 - 00:20
Title:move away from using hook_menu_alter» Use hook_og_links_alter() to remove content types
Version:6.x-1.0-rc1» 6.x-1.x-dev
Category:feature request» bug report

By 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.

#2

JamesK - August 15, 2009 - 00:27
Title:Use hook_og_links_alter() to remove content types» Use hook_og_links_alter() to remove content types from og group details block

#3

ajayg - August 15, 2009 - 15:55

I 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.

 
 

Drupal is a registered trademark of Dries Buytaert.