You are here

function og_theme in Organic groups 5.2

Same name and namespace in other branches
  1. 8 og.module \og_theme()
  2. 5.8 og.module \og_theme()
  3. 5 og.module \og_theme()
  4. 5.3 og.module \og_theme()
  5. 5.7 og.module \og_theme()
  6. 6.2 og.module \og_theme()
  7. 6 og.module \og_theme()

Override theme based on what group is being displayed (if any). Be smart about selecting the 'active' group for ambigous urls like node/$nid

Parameters

none:

Return value

none

1 call to og_theme()
og_init in ./og.module
This processing cannot happen later in the request because

File

./og.module, line 204

Code

function og_theme() {
  global $custom_theme;
  $group_node = NULL;

  // a node object containing the 'active' group for this request
  if (arg(0) == 'og' && is_numeric(arg(2))) {
    $group_node = og_set_theme(arg(2));
  }
  elseif (arg(0) == 'node' && is_numeric(arg(1))) {
    $group_node = og_set_theme(arg(1));
  }
  elseif (arg(0) == 'node' && arg(1) == 'add' && arg(2) == 'book' && arg(3) == 'parent') {
    $group_node = og_set_theme(arg(4));
    $_REQUEST['edit']['og_groups'][] = $group_node->nid;

    // checks the right box on node form
  }
  elseif (arg(0) == 'node' && arg(1) == 'add' && isset($_REQUEST['gids'])) {
    $gid = intval(current($_REQUEST['gids']));
    $group_node = node_load($gid);
    $custom_theme = $group_node->og_theme;
  }
  elseif (arg(0) == 'comment' && is_numeric(arg(2))) {
    $group_node = og_set_theme(arg(2));
  }
  og_set_group_context($group_node);
}