Closed CategoryTree return no data

RisteDimitrievski

Active member
Licensed customer
Affected version
2.2.12
method getViewableCategories() function return no Categories data but these categories already exists.

PHP:
use XF\ControllerPlugin\AbstractCategoryTree;
use XF\Mvc\ParameterBag;

class CategoryTree extends AbstractCategoryTree
{
    protected $viewFormatter = 'downloadsystem\XF:Category\%s';
    protected $templateFormatter = 'xf_rd_downloadsystem_category_%s';
    protected $routePrefix = 'download-system/categories';
    protected $entityIdentifier = 'downloadsystem\XF:Category';
    protected $primaryKey = 'category_id';
    public function getCategoriesListData()
    {
        $categoryRepo = $this->getCategoryRepo();
        $categories = $categoryRepo->getViewableCategories();
        $categoryTree = $categoryRepo->createCategoryTree($categories);
        $categoryExtra = $categoryRepo->getCategoryListExtras($categoryTree);
        return [
            'categories' => $categories,
            'categoryTree' => $categoryTree,
            'categoryExtras' => $categoryExtra
        ];
    }
}
 
Automated triage: Not a bug

Thank you for reporting this issue. This method only returns categories the visitor has permission to view, and it runs the category entity's own view check. A custom add-on needs its own category permissions in place for anything to come back. This report is old and nothing recent confirms a core problem, so if it still happens on the current version, please post a new report with full reproduction steps.

This is an automated assessment. A member of staff may review and update it.
 
Back
Top Bottom