From eed54b48404341e908ad8eb95d17778cccc312f7 Mon Sep 17 00:00:00 2001 From: ikawhero Date: Fri, 12 Jan 2007 06:48:05 +0000 Subject: [PATCH] Can delete last profile category if there are no fields in it. --- user/profile/lib.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/user/profile/lib.php b/user/profile/lib.php index 03183adf25..f409ac615a 100644 --- a/user/profile/lib.php +++ b/user/profile/lib.php @@ -578,10 +578,14 @@ function profile_delete_category ($id) { /// Retrieve the next category down if (!($newcategory = get_record('user_info_category', 'sortorder', ($category->sortorder + 1))) ) { - /// We cannot find any other categories next to current one: - /// 1. The sortorder values are incongruous which means a bug somewhere - /// 2. We are the only category => cannot delete this category! - return false; + if (count_records('user_info_field', 'categoryid', $category->id) > 0) { + + /// We cannot find any other categories next to current one so either: + /// 1. The sortorder values are incongruous which means a bug somewhere + /// 2. We are the only category but there are fields => cannot delete this category! + + return false; + } } } -- 2.39.5