Commit 5a5e9bde authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Set profile fields email, firstname and lastname correctly.

parent 45d275ea
...@@ -64,11 +64,20 @@ if (isset($_REQUEST['key'])) { ...@@ -64,11 +64,20 @@ if (isset($_REQUEST['key'])) {
function register_profile_submit($values) { function register_profile_submit($values) {
global $registration, $SESSION; global $registration, $SESSION;
db_begin();
// Move the user record to the usr table from the registration table // Move the user record to the usr table from the registration table
$registrationid = $registration->id; $registrationid = $registration->id;
unset($registration->id); unset($registration->id);
$registration->id = insert_record('usr', $registration, 'id', true); $registration->id = insert_record('usr', $registration, 'id', true);
log_debug($registration);
// Insert standard stuff as artefacts
set_profile_field($registration->id, 'email', $registration->email);
set_profile_field($registration->id, 'firstname', $registration->firstname);
set_profile_field($registration->id, 'lastname', $registration->lastname);
// Delete the old registration record
delete_records('usr_registration', 'id', $registrationid); delete_records('usr_registration', 'id', $registrationid);
// Set mandatory profile fields // Set mandatory profile fields
...@@ -80,6 +89,8 @@ if (isset($_REQUEST['key'])) { ...@@ -80,6 +89,8 @@ if (isset($_REQUEST['key'])) {
set_profile_field($registration->id, $field, $values[$field]); set_profile_field($registration->id, $field, $values[$field]);
} }
db_commit();
// Log the user in and send them to the homepage // Log the user in and send them to the homepage
$SESSION->login($registration); $SESSION->login($registration);
redirect(get_config('wwwroot')); redirect(get_config('wwwroot'));
...@@ -312,9 +323,11 @@ function register_submit($values) { ...@@ -312,9 +323,11 @@ function register_submit($values) {
get_string('registeredemailmessagehtml', 'auth.internal', $values['key'], $values['key'])); get_string('registeredemailmessagehtml', 'auth.internal', $values['key'], $values['key']));
} }
catch (EmailException $e) { catch (EmailException $e) {
log_warn($e);
die_info(get_string('registrationunsuccessful', 'auth.internal')); die_info(get_string('registrationunsuccessful', 'auth.internal'));
} }
catch (SQLException $e) { catch (SQLException $e) {
log_warn($e);
die_info(get_string('registrationunsuccessful', 'auth.internal')); die_info(get_string('registrationunsuccessful', 'auth.internal'));
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment