You are here

function i18n_access_user_update in Translation Access 7

Implements hook_user_update().

File

./i18n_access.module, line 36
file_description

Code

function i18n_access_user_update(&$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']);
    }
  }
}