--- lib.php.old 2008-05-20 16:03:36.929807520 +0200 +++ lib.php 2008-05-20 16:10:53.385456176 +0200 @@ -3069,4 +3069,22 @@ return false; } +/* + * Get a category list with the given categoryid and all of it's children removed. + * + * @param array $categorylist - categoryid-keyed array + * @param array $parentslist - array of category parents as provided by make_categories_list() + * @param int $categoryid - the id of the category to filter out + * @return array $filtered_category_list + */ +function remove_self_and_children_categories($categorylist, $parentslist, $categoryid) { + unset($categorylist[$categoryid]); + foreach ($parentslist as $key => $parents) { + if (in_array($categoryid, $parents)) { + unset($categorylist[$key]); + } + } + return $categorylist; +} + ?>