diff --git a/src/Content/Widget.php b/src/Content/Widget.php index b5ccd6f14d..8633992870 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -318,23 +318,20 @@ class Widget /** * Return categories widget * - * @param string $baseurl baseurl - * @param string $selected optional, default empty + * @param int $uid Id of the user owning the categories + * @param string $baseurl Base page URL + * @param string $selected Selected category * @return string|void * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public static function categories($baseurl, $selected = '') + public static function categories(int $uid, string $baseurl, string $selected = '') { - $a = DI::app(); - - $uid = intval($a->getProfileOwner()); - if (!Feature::isEnabled($uid, 'categories')) { return ''; } $terms = array(); - foreach (Post\Category::getArray(local_user(), Post\Category::CATEGORY) as $savedFolderName) { + foreach (Post\Category::getArray($uid, Post\Category::CATEGORY) as $savedFolderName) { $terms[] = ['ref' => $savedFolderName, 'name' => $savedFolderName]; } diff --git a/src/Module/Profile/Status.php b/src/Module/Profile/Status.php index 1c07281b2f..bb4537d6cc 100644 --- a/src/Module/Profile/Status.php +++ b/src/Module/Profile/Status.php @@ -118,7 +118,7 @@ class Status extends BaseProfile $commvisitor = $commpage && $remote_contact; DI::page()['aside'] .= Widget::postedByYear(DI::baseUrl() . '/profile/' . $profile['nickname'] . '/status', $profile['profile_uid'] ?? 0, true); - DI::page()['aside'] .= Widget::categories(DI::baseUrl() . '/profile/' . $profile['nickname'] . '/status', XML::escape($category)); + DI::page()['aside'] .= Widget::categories($profile['uid'], DI::baseUrl() . '/profile/' . $profile['nickname'] . '/status', $category); DI::page()['aside'] .= Widget::tagCloud($profile['uid']); if (Security::canWriteToUserWall($profile['uid'])) {