You are here

function og_subgroups_diff_groups in Subgroups for Organic groups 7.2

Computes the gids that are in $groups but not in $groups2.

2 calls to og_subgroups_diff_groups()
OgSubgroupHelperFunctionUnitTestCase::testOgSubgroupHelperFunctions in ./og_subgroups.test
Tests drupal_array_diff_assoc_recursive().
og_subgroup_user_groups_load in ./og_subgroups.common.inc
Return all the groups a user belongs to.

File

./og_subgroups.common.inc, line 24
Common functions used in og_subgroups.

Code

function og_subgroups_diff_groups($groups, $groups2) {
  $return = array();
  foreach ($groups as $group_type => $ids) {
    if (!empty($groups2[$group_type]) && ($gids = array_diff($ids, $groups2[$group_type]))) {
      $return[$group_type] = $gids;
    }
    elseif (empty($groups2[$group_type])) {
      $return[$group_type] = $ids;
    }
  }
  return $return;
}