Merge pull request #11258 from MrPetovan/bug/11234-categories-profile

Show only the user's categories on their profile
This commit is contained in:
Michael Vogel 2022-02-20 06:35:37 +01:00 committed by GitHub
commit d5373c583b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

View file

@ -318,23 +318,20 @@ class Widget
/** /**
* Return categories widget * Return categories widget
* *
* @param string $baseurl baseurl * @param int $uid Id of the user owning the categories
* @param string $selected optional, default empty * @param string $baseurl Base page URL
* @param string $selected Selected category
* @return string|void * @return string|void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @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')) { if (!Feature::isEnabled($uid, 'categories')) {
return ''; return '';
} }
$terms = array(); $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]; $terms[] = ['ref' => $savedFolderName, 'name' => $savedFolderName];
} }

View file

@ -118,7 +118,7 @@ class Status extends BaseProfile
$commvisitor = $commpage && $remote_contact; $commvisitor = $commpage && $remote_contact;
DI::page()['aside'] .= Widget::postedByYear(DI::baseUrl() . '/profile/' . $profile['nickname'] . '/status', $profile['profile_uid'] ?? 0, true); 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']); DI::page()['aside'] .= Widget::tagCloud($profile['uid']);
if (Security::canWriteToUserWall($profile['uid'])) { if (Security::canWriteToUserWall($profile['uid'])) {