Loading...
 
Features / Usability

Features / Usability


Re: Categories not showing on Wiki page category listing

posts: 224 Ireland

I found the problem myself in the get_categoryobjects() function in lib/tikilib.php. This routine contains following snippet:

foreach ($objectcat["data"] as $obj) {
            $type = $obj["type"];
            if (!($this->in_multi_array($obj['name'], $listcat))) {
                if (isset($typetitles["$type"])) {
                    $listcat["{$typetitles["$type"]}"][] = $obj;
                } elseif (isset($type)) {
                    $listcat["$type"][] = $obj;
                }
            }
        }


The check to remove duplicates on line 3 is bogus because it can very well be for category objects of different types - e.g. file gallery or wiki page - to have the same name. Name is not a good unique identifier which explains also why the problem wasn't always happening as I didn't have naming conflicts across all categories.

I don't think it is otherwise possible to add duplicate objects of the same name and type to the category tables so I would say this check can be eliminated all together. It works for me anyway.

Corrected code:

foreach ($objectcat["data"] as $obj) {
            $type = $obj["type"];
            if (isset($typetitles["$type"])) {
                $listcat["{$typetitles["$type"]}"][] = $obj;
            } elseif (isset($type)) {
                $listcat["$type"][] = $obj;
            }
        }