-
Bug
-
Resolution: Won't Fix
-
Minor
-
None
-
2.0.3
-
MOODLE_20_STABLE
In /user/profile/lib.php
function profile_display_fields($userid) {
|
global $CFG, $USER, $DB;
|
|
if ($categories = $DB->get_records('user_info_category', null, 'sortorder ASC')) {
|
foreach ($categories as $category) {
|
if ($fields = $DB->get_records('user_info_field', array('categoryid'=>$category->id), 'sortorder ASC')) {
|
foreach ($fields as $field) {
|
require_once($CFG->dirroot.'/user/profile/field/'.$field->datatype.'/field.class.php');
|
$newfield = 'profile_field_'.$field->datatype;
|
$formfield = new $newfield($field->id, $userid);
|
if ($formfield->is_visible() and !$formfield->is_empty()) {
|
print_row(format_string($formfield->field->name.':'), $formfield->display_data());
|
}
|
}
|
}
|
}
|
}
|
}
|
"There is no need to fetch the categories - you fetch all categories and then fetch all fields for each category = all fields that have a valid category. You could either join to the category table of if the category had to be valid (NOT NULL) then selecting all fields is fine." - Sam in MDL-26774 about the get_users_by_id that was copied from this above piece of code
- has been marked as being related by
-
MDL-26774 Fix moodle_user_get_users_by_id
-
- Closed
-