mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
MDL-18293 $DB->something is using exceptions, no need for ifs there, removing useless strings
This commit is contained in:
parent
7826abc79f
commit
2a7eff41ad
8 changed files with 30 additions and 59 deletions
|
@ -97,15 +97,11 @@
|
|||
$usernew->mnethostid = $CFG->mnet_localhost_id; // always local user
|
||||
$usernew->confirmed = 1;
|
||||
$usernew->password = hash_internal_user_password($usernew->newpassword);
|
||||
if (!$usernew->id = $DB->insert_record('user', $usernew)) {
|
||||
print_error('cannotcreateuser');
|
||||
}
|
||||
$usernew->id = $DB->insert_record('user', $usernew);
|
||||
$usercreated = true;
|
||||
|
||||
} else {
|
||||
if (!$DB->update_record('user', $usernew)) {
|
||||
print_error('cannotupdateuser', 'message');
|
||||
}
|
||||
$DB->update_record('user', $usernew);
|
||||
// pass a true $userold here
|
||||
if (! $authplugin->user_update($user, $userform->get_data())) {
|
||||
// auth update failed, rollback for moodle
|
||||
|
|
|
@ -36,15 +36,12 @@ if (empty($preferences['newemailattemptsleft'])) {
|
|||
print_continue("$CFG->wwwroot/user/view.php?id=$user->id");
|
||||
} else {
|
||||
// update user email
|
||||
if (!$DB->set_field('user', 'email', $user->email, array('id' => $user->id))) {
|
||||
print_error('cannotupdateuser');
|
||||
} else {
|
||||
events_trigger('user_updated', $user);
|
||||
$a->email = $user->email;
|
||||
$stremailupdatesuccess = get_string('auth_emailupdatesuccess', 'auth', $a);
|
||||
print_box($stremailupdatesuccess, 'center');
|
||||
print_continue("$CFG->wwwroot/user/view.php?id=$user->id");
|
||||
}
|
||||
$DB->set_field('user', 'email', $user->email, array('id' => $user->id));
|
||||
events_trigger('user_updated', $user);
|
||||
$a->email = $user->email;
|
||||
$stremailupdatesuccess = get_string('auth_emailupdatesuccess', 'auth', $a);
|
||||
print_box($stremailupdatesuccess, 'center');
|
||||
print_continue("$CFG->wwwroot/user/view.php?id=$user->id");
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue