You are here

function i18n_access_user_insert in Translation Access 7

Implements hook_user_insert().

File

./i18n_access.module, line 13
file_description

Code

function i18n_access_user_insert(&$edit, &$account, $category = NULL) {
  if ($category == 'account') {

    // see user_admin_perm_submit()
    if (isset($edit['i18n_access'])) {
      db_delete('i18n_access')
        ->condition('uid', $account->uid)
        ->execute();
      $edit['i18n_access'] = array_filter($edit['i18n_access']);
      if (count($edit['i18n_access'])) {
        db_insert('i18n_access')
          ->fields(array(
          'uid' => $account->uid,
          'perm' => implode(', ', array_keys($edit['i18n_access'])),
        ))
          ->execute();
      }
      unset($edit['i18n_access']);
    }
  }
}