Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Can delete last profile category if there are no fields in it.

  • Loading branch information...
commit eed54b48404341e908ad8eb95d17778cccc312f7 1 parent acc9c3e
ikawhero authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 user/profile/lib.php
View
12 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;
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.