Using OG Menus with the Spaces Module

TKS - September 23, 2009 - 01:54
Project:OG Menu
Version:6.x-1.3
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I'm in the process of building a site that uses the"Spaces OG module, and want to be able to use OG Menus in the two dozen or so OG-based spaces we'll have.

I've created the menus for each group, and can get them to appear on standard group posts -- and even when editing the group node itself. But when actually viewing the group node -- which Spaces OG essentially replaces -- the menu doesn't display.

Can you please point me to the "trigger" or hook that tells this module to display the OG Menu? The "homepage" that Spaces OG creates for each group is closely linked to the group node -- the spaces_get_space() function will pull group node's NID, content type, and various og_ data points -- but I can't tell from looking at the OG Menu module code what signal a group node sends that Spaces OG does not.

Thanks in advance for any tips.

#1

TKS - September 23, 2009 - 14:28

OK, so the function I was looking for is _og_menu_get_menu_block().

On line 423 of og_menu.module, there's this:

  // get current node
  if (arg(0) == 'node') {
    $nid = arg(1);
  }

... and then the $nid is used to pull in the OG Menu for the appropriate group.

If I add something like this:

// hack to handle program home pages
// will need to find a more elegant way, and include the other paths
if (arg(0) == 'home') {
$space = spaces_get_space();
$nid =  $space->group->nid;
  }

I can use the path of the Spaces_OG homepage, and then us spaces_get_space() to extract the $nid I need.

So problem solved, I guess -- but in an ugly, poorly coded, hack sort of way. Any suggestions on better approaches?

Thanks again.

#2

SocialNicheGuru - October 14, 2009 - 13:34

will try this out :)

Chris

#3

RoboPhred - October 26, 2009 - 19:58

Try skipping the arg() nonsense and use menu_get_object(), that should return the node being viewed.

http://api.drupal.org/api/function/menu_get_object

 
 

Drupal is a registered trademark of Dries Buytaert.