You are here

function og_init in Organic groups 6.2

Same name and namespace in other branches
  1. 5.8 og.module \og_init()
  2. 5 og.module \og_init()
  3. 5.2 og.module \og_init()
  4. 5.3 og.module \og_init()
  5. 5.7 og.module \og_init()
  6. 6 og.module \og_init()

Implementation of hook_init().

File

./og.module, line 533
Code for the Organic Groups module.

Code

function og_init() {

  // We have to perform a load in order to assure that the $user->og_groups bits
  // are present.
  global $user;
  if ($user->uid) {

    // $user gets modified by reference.
    og_user('load', array(), $user);
  }
  else {
    $user->og_groups = array();
  }
  drupal_add_css(drupal_get_path('module', 'og') . '/theme/og.css');
  drupal_add_js(drupal_get_path('module', 'og') . '/og.js');

  // Set group context and language if needed.
  if (!og_get_group_context() && ($group_node = og_determine_context())) {
    og_set_group_context($group_node);
  }
}