You are here

function user_set_authmaps in Drupal 4

Same name and namespace in other branches
  1. 5 modules/user/user.module \user_set_authmaps()
  2. 6 modules/user/user.module \user_set_authmaps()
  3. 7 modules/user/user.module \user_set_authmaps()
1 call to user_set_authmaps()
user_save in modules/user.module
Save changes to a user account or add a new user.

File

modules/user.module, line 860
Enables the user registration and login system.

Code

function user_set_authmaps($account, $authmaps) {
  foreach ($authmaps as $key => $value) {
    $module = explode('_', $key, 2);
    if ($value) {
      db_query("UPDATE {authmap} SET authname = '%s' WHERE uid = %d AND module = '%s'", $value, $account->uid, $module['1']);
      if (!db_affected_rows()) {
        db_query("INSERT INTO {authmap} (authname, uid, module) VALUES ('%s', %d, '%s')", $value, $account->uid, $module[1]);
      }
    }
    else {
      db_query("DELETE FROM {authmap} WHERE uid = %d AND module = '%s'", $account->uid, $module['1']);
    }
  }
}