I ve written this piece of code, which outputs the profile_display_fields
for the $USER:
$appearance = profile_display_fields($USER->id);
if (empty($appearance)) {
//Do nothing
} else {
foreach ($appearance as $c) {
$custom .= <a href= .$CFG->wwwroot. /course/view.php?id= .$c->id. > .$c->fullname. </a> ;
}
}
Here is the function I m using:
function profile_display_fields($userid) {
global $CFG, $USER;
if ($categories = get_records_select( user_info_category , , sortorder ASC )) {
foreach ($categories as $category) {
if ($fields = get_records_select( user_info_field , "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(s($formfield->field->name. : ), $formfield->display_data());
}
}
}
}
}
}
What I m looking to do is try some var_dump
s to output the correct data.
However can anyone help me identify the variables?