You are here

function regcode_og_regcode_used in Registration codes 6.2

Same name and namespace in other branches
  1. 6 regcode_og/regcode_og.module \regcode_og_regcode_used()
  2. 7.2 regcode_og/regcode_og.module \regcode_og_regcode_used()
  3. 7 regcode_og/regcode_og.module \regcode_og_regcode_used()

Implements hook_regcode_used()

Add the new role to the user

File

regcode_og/regcode_og.module, line 199

Code

function regcode_og_regcode_used(&$edit, &$account, $regcode) {

  // Do nothing if the regcode is not valid
  if (!is_object($regcode)) {
    return;
  }

  // Grab applicable roles for tags used
  $rules = regcode_og_get_rules($regcode->tags);

  // Apply the rules
  foreach ($rules as $rule) {
    og_save_subscription($rule['ogid'], $account->uid, array(
      'is_active' => 1,
    ));
  }
}