You are here

function og_init in Organic groups 5.2

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

This processing cannot happen later in the request because

  • menu items will be in default language if we wait until og_menu(!$may_cache). bad for locale feature

File

./og.module, line 133

Code

function og_init() {

  // only bother when we are not serving a cached page. check for which function that only exists afterwards
  if (function_exists('drupal_set_content')) {

    // we have to perform a load in order to assure that the $user->og_groups bits are present.
    global $user;
    if ($user->uid) {
      $user = user_load(array(
        'uid' => $user->uid,
      ));
    }
    else {
      $user->og_groups = array();
    }
    require dirname(__FILE__) . '/og_views.inc';
    og_theme();
    og_set_locale();
  }
}