From 2cf089c94f2ecd26df13862ed4d1ffeaa101fe6a Mon Sep 17 00:00:00 2001 From: stronk7 Date: Tue, 23 Jan 2007 16:21:21 +0000 Subject: [PATCH] Changing some more incorrect uses of get_records and count_records with '1'. MDL-8280 --- user/profile/index.php | 12 ++++++------ user/profile/lib.php | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/user/profile/index.php b/user/profile/index.php index 717755eb17..ec55cb8672 100644 --- a/user/profile/index.php +++ b/user/profile/index.php @@ -47,7 +47,7 @@ switch ($action) { break; case 'deletecategory': if ($confirm and confirm_sesskey()) { - $categorycount = count_records_select('user_info_category', '1'); + $categorycount = count_records('user_info_category'); $fieldcount = count_records('user_info_field', 'categoryid', $id); /// Can only delete the last category if there are no fields in it @@ -118,7 +118,7 @@ if ( ($action == 'editcategory' )) { if ($data = $categoryform->get_data()) { if ($data->id == 0) { unset($data->id); - $data->sortorder = count_records_select('user_info_category', '1') + 1; + $data->sortorder = count_records('user_info_category') + 1; if (!insert_record('user_info_category', $data, false)) { error('There was a problem adding the record to the database'); exit; @@ -220,7 +220,7 @@ if ( ($action == 'editcategory' )) { print_heading(get_string('profilefields', 'admin')); /// Check that we have at least one category defined - if (count_records_select('user_info_category', '1') == 0) { + if (count_records('user_info_category') == 0) { unset($defaultcategory); $defaultcategory->name = $strdefaultcategory; $defaultcategory->sortorder = 1; @@ -229,8 +229,8 @@ if ( ($action == 'editcategory' )) { /// We only displaying if there are fields defined or there is a category with a name different to the default name if ( ( (count_records_select('user_info_category', "name<>'$strdefaultcategory'") > 0) or - (count_records_select('user_info_field', '1') > 0) ) and - ( $categories = get_records_select('user_info_category', '1', 'sortorder ASC')) ) { + (count_records('user_info_field') > 0) ) and + ( $categories = get_records_select('user_info_category', '', 'sortorder ASC')) ) { foreach ($categories as $category) { @@ -296,7 +296,7 @@ function profile_category_icons ($category) { $str->edit = get_string("edit"); $editstr = ''; - $categorycount = count_records_select('user_info_category', '1'); + $categorycount = count_records('user_info_category'); $fieldcount = count_records('user_info_field', 'categoryid', $category->id); /// Edit diff --git a/user/profile/lib.php b/user/profile/lib.php index e3e7e420bb..c8206ca2a8 100644 --- a/user/profile/lib.php +++ b/user/profile/lib.php @@ -524,7 +524,7 @@ function profile_move_category ($id, $move='down') { } /// Count the number of categories - $categorycount = count_records_select('user_info_category', '1'); + $categorycount = count_records('user_info_category'); /// Calculate the new sortorder if ( ($move == 'up') and ($category->sortorder > 1)) { @@ -557,7 +557,7 @@ function profile_move_category ($id, $move='down') { * @return array */ function profile_list_categories() { - if ( !($categories = get_records_select_menu('user_info_category', '1', 'sortorder ASC', 'id, name')) ) { + if ( !($categories = get_records_select_menu('user_info_category', '', 'sortorder ASC', 'id, name')) ) { $categories = array(); } return $categories; -- 2.39.5