Skip to content

Commit

Permalink
MDL-60267 user: Fix set default data for the user profile field
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerbaba committed Nov 2, 2018
1 parent e1e20d0 commit 8208392
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions user/profile/lib.php
Expand Up @@ -185,6 +185,10 @@ public function edit_save_data($usernew) {
$data = new stdClass();

$usernew->{$this->inputname} = $this->edit_save_data_preprocess($usernew->{$this->inputname}, $data);
if (!isset($usernew->{$this->inputname})) {
// Field cannot be set to null, set the default value.
$usernew->{$this->inputname} = $this->field->defaultdata;
}

$data->userid = $usernew->id;
$data->fieldid = $this->field->id;
Expand Down

0 comments on commit 8208392

Please sign in to comment.