I've found that when a vocabulary is associated with a group, the terms in that group do not receive the group theme, when you're viewing a page like taxonomy/term/4. I'm using OG 6.x-2.0 and OG Vocabulary 6.x-1.1.

I see that og_init gets called first and that sets the default theme, and that this function uses the current menu item to determine the group theme. Then, og_vocab_init gets called, which itself correctly sets the group context for that term we are viewing, but this has no effect - as far as I can tell the theme is not set based on this new context. Even if og_vocab_init is called before og_init, it doesn't help because the function og_determine_context does not use the context that was set by og_vocab_init - it seems to be just looking for context from the current menu item?

Shouldn't we just be setting the theme at the same time as we set the context?

So line 144 of og_vocab.module, instead of:

    if ($gid = og_vocab_get_group($term->vid)) {
      // Set the group context.
      og_set_group_contextnode_load($gid));
    }

Do:

    if ($gid = og_vocab_get_group($term->vid)) {
      // Set the group context.
      og_set_theme(og_set_group_context(node_load($gid)));
    }

At least this works for me - I'm wondering if there's some confusion (well, at least I'm confused ;-)) with the usefuleness of og_set_group_context - one would think that it would set the context that would then be accessed by og.module to display the correct theme, but I don't think it does. I'm not sure if this is something that needs to be changed in og.module, or if we just fix it here, in og_vocab.module?

I've run into a similar issue with organic groups panels pages not receiving the correct theme (http://drupal.org/node/595820) and I hacked the og.module to get the correct context - I suspect this is a related issue, and og_panels should also be running og_set_theme, or og.module should respect the context set by other modules...

I'm happy to provide a patch if this is the right way to go...

Comments

el56’s picture

subscribe

nx7208’s picture

I spend one day to solve this problem.
Your method is right answer for me.
Thanks a lot.