You are here

function _og_subgroups_clear_caches_for_group in Subgroups for Organic groups 7.2

Helper function.

See also

og_subgroups_clear_caches_for_group().

1 call to _og_subgroups_clear_caches_for_group()
og_subgroups_clear_caches_for_group in ./og_subgroups.module
Clears out the caches for a given group.

File

./og_subgroups.module, line 385
Provides users the ability to inherit permissions on subgroups.

Code

function _og_subgroups_clear_caches_for_group($group_type, $group_id) {

  // Don't bother clearing for user, not currently working for og subgroups.
  if ($group_type == 'user') {
    return;
  }
  $clear = array(
    'og_subgroups_parents_load' => array(
      $group_type . '__' . $group_id . '__1__1__1',
      $group_type . '__' . $group_id . '__1__0__1',
      $group_type . '__' . $group_id . '__1__1__0',
      $group_type . '__' . $group_id . '__1__0__0',
      $group_type . '__' . $group_id . '__0__1__1',
      $group_type . '__' . $group_id . '__0__0__1',
      $group_type . '__' . $group_id . '__0__1__0',
      $group_type . '__' . $group_id . '__0__0__0',
    ),
    'og_subgroups_children_load' => array(
      $group_type . '__' . $group_id . '__1__1__1',
      $group_type . '__' . $group_id . '__1__0__1',
      $group_type . '__' . $group_id . '__1__1__0',
      $group_type . '__' . $group_id . '__1__0__0',
      $group_type . '__' . $group_id . '__0__1__1',
      $group_type . '__' . $group_id . '__0__0__1',
      $group_type . '__' . $group_id . '__0__1__0',
      $group_type . '__' . $group_id . '__0__0__0',
    ),
    'og_subgroups_parents_load_multiple' => array(
      'og_subgroups_parents_load_multiple__' . $group_type . '__' . $group_id . '__all',
      'og_subgroups_parents_load_multiple__' . $group_type . '__' . $group_id . '__filtered',
    ),
    'og_subgroups_children_load_multiple' => array(
      'og_subgroups_children_load_multiple__' . $group_type . '__' . $group_id . '__all',
      'og_subgroups_children_load_multiple__' . $group_type . '__' . $group_id . '__filtered',
    ),
  );
  foreach ($clear as $function_name => $cids) {
    $cache =& drupal_static($function_name, array());
    foreach ($cids as $cid) {
      unset($cache[$cid]);
      cache_clear_all($cid, 'cache');
    }
  }
  drupal_static_reset('og_subgroups_get_associated_entities');
  drupal_static_reset('og_subgroups_get_potentional_parents');
  drupal_static_reset('og_subgroups_children_load_multiple_all');
  cache_clear_all('og_subgroups_get_potentional_parents', 'cache', TRUE);
}