Skip to content

Commit

Permalink
Can delete last profile category if there are no fields in it.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikawhero committed Jan 12, 2007
1 parent acc9c3e commit eed54b4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions user/profile/lib.php
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit eed54b4

Please sign in to comment.