Is there any way to make newly created groups default to a different theme to the main site? I don't want users to be able to choose the themes, simply that all groups are themed using a different theme to the non-group parts of the site.

Thanks, Stephen

Comments

moshe weitzman’s picture

requires custom code that listens on nodeapi('submit'). i am not aware of this existing.

scedwar’s picture

This is well beyond my drupal skills, but I do think this would be a useful feature to add in light of the work here:
http://drupal.org/node/192933

There is a use case for such functionality where there are quite different types of groups being created.

scedwar’s picture

Version:5.x-4.3» 5.x-5.0
Category:support» feature
cmsproducer’s picture

I suggest the following approach:
- In the main theme's page.tpl.php, detect the node type (book,page,og etc) and add a line to include the OG-specific theme
- I am using as similar approach to generate node as XML data by capturing a GET value in the URL, but here is an even closer example from http://drupal.org/node/153918 that is based on the content-type

<?php
if ($node->type == 'organic_groups') {
include (
'page-og.tpl.php');
return;
}
?>

This code will catch all the organic groups and thus prevent customised groups from using different themes. Pending better code, that aspect can be solved by using one of the available theme switching modules out there to allocate customised OGs a different theme that does not have he catch-code above.

That should get you exactly what you want without unnecessarily tinkering with he OG module, or writing a new one. Let me know if this sounds like what you want, and if you need my input

scedwar’s picture

Very neat and would certainly solve my immediate problem for a simple one theme variant. Thank you.
I'll leave this open as it would be nice to see the functionality in og to allow group admins to choose from multiple themes with a default always applied, but this will work well for the moment. Thanks for the suggestion. There are always so many different ways to solve a problem in Drupal!

lejon’s picture

Hi,

I would like to do this as well, but I don't quite get where to put the code.

Let's say my main theme is called 'maintheme' and I want my group to have the theme 'mainthemegroup' then I set up two folders in my themes folder with these names.

What do I do next in terms of the code above i.e. how to I get the 'maintheme' to call up the 'mainthemegroup'?

Does the "page-og.tpl.php" refer to a php file in the main theme's folder?

Sorry for being dense...

scedwar’s picture

I received these very helpful answers:
http://drupal.org/node/215914

develCuy’s picture

This functionality is already implement in Sections module: http://drupal.org/project/sections, it would be nice to extend Sections module for supporting Organic Groups.

Blessings!