So here's a tangle (the goal is to have a custom theme per space):

og_theme sets a custom theme, given you're in an og_context. spaces_og sets that context fine in D6, but in D7 the theme/init order was changed in bootstrap -- custom themes are setup before hook_init() is called. PURL does it's magic in hook_init(), meaning space_og's og_context is activated during hook_init(), after custom theme is set, so og_theme (which works fine sans spaces) never gets set due to og_context being activated too late.

This is kinda a collaboration bug between spaces_og & PURL, see #1529842: og_theme doesn't work with spaces_og due to D7 boot sequence. The fix I'm using, which is terrible, is replacing PURL's hook_init with hook_custom_theme. hook_boot is too early (all kinds of errors due to modules not being loaded & path not available), hook_init is too late, hook_custom_theme is just right -- but completely nonsensical.

Comments

lefnire’s picture

StatusFileSize
new542 bytes

again, this patch does the job, but it's not ideal - just starting the convo

mkalkbrenner’s picture

Same here with ThemeKey. I tried to access purl stuff created by mobile tools. My workaround is to call purl_init() from themekey_custom_theme() if needed.

@lefnire: Implementing purl_custom_theme() like in your patch doesn't fix the issue for all cases. It depends on the order all hook_custom_theme implementations.

grndlvl’s picture

Status: Active » Needs review
StatusFileSize
new448 bytes
new452 bytes

I looked into this issue a bit and I really don't see a better solution.

For reference: _drupal_bootstrap_full()

    menu_set_custom_theme();
    drupal_theme_initialize(); // Calls hook_custom_theme();
    module_invoke_all('init');

I think we are stuck with this solution for now, however, I wonder if this would be better suited in og_theme.

Rerolled patch from within module's dir.

Also attached a patch for og_theme in case it is preferred to be be there instead.

abarket’s picture

@grndlvl I posted an updated version of your og_theme patch in the og_theme issue queue here...
#1715712: PURL needs to be initialized if it exists

socialnicheguru’s picture

1529892-3-purl.patch does not apply

kristiaanvandeneynde’s picture

Issue summary: View changes
Status: Needs review » Closed (duplicate)