- Patch #145058 by pwolanin: update parents when a child is deleted.

6.x
Dries Buytaert 2007-05-28 06:24:41 +00:00
parent 7131fd5313
commit ee2afa19d0
1 changed files with 5 additions and 0 deletions

View File

@ -1261,6 +1261,11 @@ function _menu_delete_item($item) {
}
}
db_query('DELETE FROM {menu_links} WHERE mlid = %d', $item['mlid']);
// Update the has_children status of the parent
$children = (bool)db_result(db_query("SELECT COUNT(*) FROM {menu_links} WHERE plid = %d AND hidden = 0", $item['plid']));
db_query("UPDATE {menu_links} SET has_children = %d WHERE mlid = %d", $children, $item['plid']);
menu_cache_clear($item['menu_name']);
}
}