Commit 7b15a363 authored by Juan Leyva's avatar Juan Leyva Committed by Eloy Lafuente
Browse files

MDL-50130 users: Filter profile fields data in external functions

parent 4f46506f
......@@ -332,8 +332,17 @@ function user_get_user_details($user, $course = null, array $userfields = array(
$newfield = 'profile_field_'.$field->datatype;
$formfield = new $newfield($field->id, $user->id);
if ($formfield->is_visible() and !$formfield->is_empty()) {
// We only use display_data in fields that require text formatting.
if ($field->datatype == 'text' or $field->datatype == 'textarea') {
$fieldvalue = $formfield->display_data();
} else {
// Cases: datetime, checkbox and menu.
$fieldvalue = $formfield->data;
}
$userdetails['customfields'][] =
array('name' => $formfield->field->name, 'value' => $formfield->data,
array('name' => $formfield->field->name, 'value' => $fieldvalue,
'type' => $field->datatype, 'shortname' => $formfield->field->shortname);
}
}
......
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