diff --git a/user/profile/definelib.php b/user/profile/definelib.php index 32d2e55d912..b60d5add2d2 100644 --- a/user/profile/definelib.php +++ b/user/profile/definelib.php @@ -451,9 +451,9 @@ function profile_list_categories() { * @param string $redirect */ function profile_edit_category($id, $redirect) { - global $DB, $OUTPUT; + global $DB, $OUTPUT, $CFG; - require_once('index_category_form.php'); + require_once($CFG->dirroot.'/user/profile/index_category_form.php'); $categoryform = new category_form(); if ($category = $DB->get_record('user_info_category', array('id' => $id))) { @@ -515,7 +515,7 @@ function profile_edit_field($id, $datatype, $redirect) { $field->description = clean_text($field->description, $field->descriptionformat); $field->description = array('text' => $field->description, 'format' => $field->descriptionformat, 'itemid' => 0); - require_once('index_field_form.php'); + require_once($CFG->dirroot.'/user/profile/index_field_form.php'); $fieldform = new field_form(null, $field->datatype); // Convert the data format for. diff --git a/user/profile/index.php b/user/profile/index.php index c688bb24cd0..6bb4be3f55c 100644 --- a/user/profile/index.php +++ b/user/profile/index.php @@ -108,12 +108,11 @@ switch ($action) { // Normal form. } -// Print the header. -echo $OUTPUT->header(); -echo $OUTPUT->heading(get_string('profilefields', 'admin')); +// Show all categories. +$categories = $DB->get_records('user_info_category', null, 'sortorder ASC'); // Check that we have at least one category defined. -if ($DB->count_records('user_info_category') == 0) { +if (empty($categories)) { $defaultcategory = new stdClass(); $defaultcategory->name = $strdefaultcategory; $defaultcategory->sortorder = 1; @@ -121,8 +120,9 @@ if ($DB->count_records('user_info_category') == 0) { redirect($redirect); } -// Show all categories. -$categories = $DB->get_records('user_info_category', null, 'sortorder ASC'); +// Print the header. +echo $OUTPUT->header(); +echo $OUTPUT->heading(get_string('profilefields', 'admin')); foreach ($categories as $category) { $table = new html_table();