Multisite or theming on one site?

public
group: Multisite
seth97 - Tue, 2008-06-17 22:27

I am running a smaller community site with D5 and Organic Groups module. It is a closed site, so you have to be an authenticated user to see any content.

One of the OG groups want to have their group homepage public as an external web page. This external site should contain exactly the same content as their group homepage, but have its own theme and no user login.
In other words, if you are logged in to my community site the group should have the same theme as for the rest of the community, but if you are anonymous user and looks at this group you will see it with a specific external theme.

I have been thinking of two possible solutions for this:

1) Set up 2 sites running from the same database. Were one is the community site and the other is a "read-only" site where anonymous user can see the group homepage with a different theme and menu system, but the same content.

2) Only one site with different themes depending on taxonomy and user role. Then I would tag the group that I want to show externally with a taxonomy term, e.g. 'external'. I would then have a special theme for the taxonomy term 'external' if the user is anonymous. If the user is authenticated he will see the standard theme even if he is looking at the taxonomy term 'external'.
http://drupal.org/project/taxonomy_theme

Any helpful ideas?
Thanks!

Simple Code

aaustin - Wed, 2008-06-18 12:44

The code to change the theme displayed on a page is relatively simple.

This is all you need to change the theme for an anonymous user to the theme 'marvin':

  global $user;
  if ($user->uid == 0){
    global $custom_theme;
    $custom_theme = 'marvin';
    init_theme(); // You may or may not need this
  }

Note: I tested this code on my test Drupal 6 site, but I think it should work on a 5 site.

Now where you put it? I am not quite sure. But I think it might be worth looking in to. Hopefully, someone else might have a better grasp on how exactly you would implement this. I have not actually built a site that takes advantage of changing themes.

thanks!

seth97 - Fri, 2008-06-27 15:59

Now I am thinking that the option: "1) Set up 2 sites running from the same database." could be better.
Maybe with: Domain Access

About option 2), theming:
I got a similar suggestion like yours from Moshe Weitzman, on how to apply a specific theme for one organic group.

This code has to run early in the request. I suggest putting it in hook_menu(!may_cache) in your custom module.

<?php
$group_node
= og_set_group_context();
$group_nid = $group_node->nid;
if (
$group_nid == 355) {
  global
$custom_theme;
 
$custom_theme = 'marvin'; //or whatever
}
?>

this is how I didi it....

seth97 - Thu, 2008-08-21 14:21

I gave up the theming and Domain Access ideas.....

Instead I constructed a new independent simple D5 site with some static html pages and I made mysql queries to get some data from the database of the main community site (such as OG member list and forum topics of a certain group).

Now i have 2 independent sites to take care of (maybe more if other groups want this feature), but it works fine!