You are here

function uif_plus_process_user_groups in User Import Framework Plus 7

Process import of users into groups.

Parameters

object $account:

array $field_info:

string $value:

1 string reference to 'uif_plus_process_user_groups'
uif_plus_uif_supported_fields in ./uif_plus.module
Implements hook_uif_supported_fields().

File

./uif_plus.module, line 341
Advanced user import from a CSV file.

Code

function uif_plus_process_user_groups($account, $field_info, $value) {
  if (drupal_strlen($value) && module_exists('og')) {
    $delimiter = variable_get('uif_value_delimiter', '|');
    $groups = explode($delimiter, $value);
    $og_version_1 = uif_plus_check_og_version_1();
    foreach ($groups as $og) {
      $gid = uif_is_natural($og) ? $og : uif_plus_get_og_group($og, $og_version_1);
      if ($gid) {

        // As of og 2.x-beta2 the signature for og_group() is different from 1.x
        if ($og_version_1) {
          og_group($gid, array(
            'entity' => $account,
          ));
        }
        else {
          og_group('node', $gid, array(
            'entity' => $account,
          ));
        }
      }
    }
  }
}