MDL-14679 fixed a lot more old style uses of insert_record()
This commit is contained in:
+2
-3
@@ -365,15 +365,14 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
$DB->set_field('user', 'deleted', 0, array('username'=>$user->username));
|
||||
echo "\t"; print_string('auth_dbreviveduser', 'auth_db', array('name'=>$user->username, 'id'=>$user->id)); echo "\n";
|
||||
|
||||
} elseif ($id = $DB->insert_record ('user',$user)) { // it is truly a new user
|
||||
} else {
|
||||
$id = $DB->insert_record ('user',$user); // it is truly a new user
|
||||
echo "\t"; print_string('auth_dbinsertuser','auth_db',array('name'=>$user->username, 'id'=>$id)); echo "\n";
|
||||
// if relevant, tag for password generation
|
||||
if ($this->config->passtype === 'internal') {
|
||||
set_user_preference('auth_forcepasswordchange', 1, $id);
|
||||
set_user_preference('create_password', 1, $id);
|
||||
}
|
||||
} else {
|
||||
echo "\t"; print_string('auth_dbinsertusererror', 'auth_db', $user->username); echo "\n";
|
||||
}
|
||||
}
|
||||
$transaction->allow_commit();
|
||||
|
||||
+1
-3
@@ -79,9 +79,7 @@ class auth_plugin_email extends auth_plugin_base {
|
||||
|
||||
$user->password = hash_internal_user_password($user->password);
|
||||
|
||||
if (! ($user->id = $DB->insert_record('user', $user)) ) {
|
||||
print_error('auth_emailnoinsert','auth_email');
|
||||
}
|
||||
$user->id = $DB->insert_record('user', $user);
|
||||
|
||||
/// Save any custom profile field information
|
||||
profile_save_data($user);
|
||||
|
||||
+9
-14
@@ -490,9 +490,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
print_error('auth_ldap_create_error', 'auth_ldap');
|
||||
}
|
||||
|
||||
if (! ($user->id = $DB->insert_record('user', $user)) ) {
|
||||
print_error('auth_emailnoinsert', 'auth_email');
|
||||
}
|
||||
$user->id = $DB->insert_record('user', $user);
|
||||
|
||||
// Save any custom profile field information
|
||||
profile_save_data($user);
|
||||
@@ -861,18 +859,15 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$user->lang = $CFG->lang;
|
||||
}
|
||||
|
||||
if ($id = $DB->insert_record('user', $user)) {
|
||||
echo "\t"; print_string('auth_dbinsertuser', 'auth_db', array('name'=>$user->username, 'id'=>$id)); echo "\n";
|
||||
if (!empty($this->config->forcechangepassword)) {
|
||||
set_user_preference('auth_forcepasswordchange', 1, $id);
|
||||
}
|
||||
$id = $DB->insert_record('user', $user);
|
||||
echo "\t"; print_string('auth_dbinsertuser', 'auth_db', array('name'=>$user->username, 'id'=>$id)); echo "\n";
|
||||
if (!empty($this->config->forcechangepassword)) {
|
||||
set_user_preference('auth_forcepasswordchange', 1, $id);
|
||||
}
|
||||
|
||||
// Add course creators if needed
|
||||
if ($creatorrole !== false and $this->iscreator($user->username)) {
|
||||
role_assign($creatorrole->id, $id, $sitecontext->id, $this->roleauth);
|
||||
}
|
||||
} else {
|
||||
echo "\t"; print_string('auth_dbinsertusererror', 'auth_db', $user->username); echo "\n";
|
||||
// Add course creators if needed
|
||||
if ($creatorrole !== false and $this->iscreator($user->username)) {
|
||||
role_assign($creatorrole->id, $id, $sitecontext->id, $this->roleauth);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user