diff --git a/user/profile/definelib.php b/user/profile/definelib.php index c73baf32486..eae98b3ea4e 100644 --- a/user/profile/definelib.php +++ b/user/profile/definelib.php @@ -418,7 +418,7 @@ function profile_list_categories() { function profile_edit_category($id, $redirect) { global $CFG, $DB, $OUTPUT; - 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))) { @@ -474,7 +474,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 17ab381403f..4c6fe664b01 100644 --- a/user/profile/index.php +++ b/user/profile/index.php @@ -87,12 +87,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) { +// Check that we have at least one category defined. +if (empty($categories)) { $defaultcategory = new stdClass(); $defaultcategory->name = $strdefaultcategory; $defaultcategory->sortorder = 1; @@ -100,8 +99,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();