You are here

function domain_rules_action_set_user_defaults_domain in Domain Rules 7

Custom hook Do on action 'set user default domain'

Parameters

string $subdomain:

int $state:

int $role_id:

File

./domain_rules.module, line 153
domain_rules.module @description Port of 'Domain rules' by shushu for Drupal7

Code

function domain_rules_action_set_user_defaults_domain($subdomain, $state, $role_id) {
  $domain = domain_lookup(NULL, $subdomain, TRUE);
  $domain_roles = variable_get('domain_roles', array());
  if ($domain['domain_id']) {
    $domain_roles[$role_id][$domain['domain_id']] = $state;
    variable_set('domain_roles', $domain_roles);
  }
  else {
    drupal_set_message(t('The domain %domain does not exist.', array(
      '%domain' => $subdomain,
    )), 'error');
  }
}