Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion com.woltlab.wcf/templates/user.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@
{/foreach}
</div>
{else}
<woltlab-core-notice type="info">{lang}wcf.user.profile.protected{/lang}</woltlab-core-notice>
{if $user->isHiddenBecauseBanned()}
<woltlab-core-notice type="info">{lang}wcf.user.profile.banned{/lang}</woltlab-core-notice>
{else}
<woltlab-core-notice type="info">{lang}wcf.user.profile.protected{/lang}</woltlab-core-notice>
{/if}
{/if}

{include file='footer'}
4 changes: 2 additions & 2 deletions com.woltlab.wcf/templates/userProfileHeader.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
>
<div class="userProfileHeader__coverPhotoContainer">
<div class="userProfileHeader__coverPhoto">
<img src="{$view->user->getCoverPhoto()->getURL()}" data-object-id="{$view->user->getCoverPhoto()->getObjectID()}" class="userProfileHeader__coverPhotoImage" alt="">
<img src="{$view->getCoverPhoto()->getURL()}" data-object-id="{$view->getCoverPhoto()->getObjectID()}" class="userProfileHeader__coverPhotoImage" alt="">
</div>

<div class="userProfileHeader__manageButtons">
Expand Down Expand Up @@ -42,7 +42,7 @@
<div class="userProfileHeader__content">
<div class="userProfileHeader__avatar">
<div class="userProfileHeader__avatarBorder">
{unsafe:$view->user->getAvatar()->getImageTag(128)}
{unsafe:$view->getAvatar()->getImageTag(128)}

{if $view->user->isOnline()}<span class="userProfileHeader__onlineIndicator jsTooltip" title="{lang username=$view->user->username}wcf.user.online.title{/lang}"></span>{/if}
</div>
Expand Down
21 changes: 21 additions & 0 deletions wcfsetup/install/files/lib/data/user/UserProfile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,26 @@ public function isAccessible(string $name, ?int $userID = null): bool
*/
public function isProtected()
{
if ($this->isHiddenBecauseBanned()) {
return true;
}

return !WCF::getSession()->hasPermission('admin.general.canViewPrivateUserOptions') && !$this->isAccessible('canViewProfile') && $this->userID !== WCF::getUser()->userID;
}

/**
* Returns true if the profile content of this user is hidden from the active
* user because this user is banned.
*
* @since 6.3
*/
public function isHiddenBecauseBanned(): bool
{
return $this->banned !== 0
&& $this->userID !== WCF::getUser()->userID
&& !WCF::getSession()->hasPermission('admin.general.canViewPrivateUserOptions');
}

/**
* Returns the age of this user.
*
Expand Down Expand Up @@ -1115,6 +1132,10 @@ public function getUserCardOptions(): array
*/
private function getVisibleUserOption(string $name): ?UserOption
{
if ($this->isHiddenBecauseBanned()) {
return null;
}

$option = UserOptionCacheBuilder::getInstance()->getData([], 'options')[$name] ?? null;
if ($option === null) {
return null;
Expand Down
8 changes: 7 additions & 1 deletion wcfsetup/install/files/lib/page/UserPage.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ public function readData()
$this->user->username . ' - ' . WCF::getLanguage()->get('wcf.user.members') . ' - ' . WCF::getLanguage()->get(\PAGE_TITLE),
true
);
MetaTagHandler::getInstance()->addTag('og:image', 'og:image', $this->user->getAvatar()->getURL(), true);
if (!$this->user->isHiddenBecauseBanned()) {
MetaTagHandler::getInstance()->addTag('og:image', 'og:image', $this->user->getAvatar()->getURL(), true);
}
}

#[\Override]
Expand All @@ -186,6 +188,10 @@ public function assignVariables()
'specialTrophyCount' => (\MODULE_TROPHY !== 0 ? \count($this->user->getSpecialTrophies()) : 0),
'userProfileHeaderView' => new UserProfileHeaderView($this->user),
]);

if ($this->user->banned !== 0) {
WCF::getTPL()->assign('allowSpidersToIndexThisPage', false);
}
}

#[\Override]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ public function getObjectClass()
return User::class;
}

#[\Override]
public function getObjectList()
{
$userList = new UserList();
$userList->getConditionBuilder()->add('user_table.banned = ?', [0]);

return $userList;
}

#[\Override]
public function getLastModifiedColumn(): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace wcf\system\view\user\profile;

use wcf\data\user\avatar\DefaultAvatar;
use wcf\data\user\avatar\IUserAvatar;
use wcf\data\user\cover\photo\IUserCoverPhoto;
use wcf\data\user\group\UserGroup;
use wcf\data\user\UserProfile;
use wcf\event\user\profile\UserProfileHeaderSearchContentLinkCollecting;
Expand Down Expand Up @@ -93,6 +96,30 @@ public function getManagementContextMenu(): StandaloneInteractionContextMenuComp
return $this->managementContextMenu;
}

/**
* @since 6.3
*/
public function getAvatar(): IUserAvatar
{
if ($this->user->isHiddenBecauseBanned()) {
return new DefaultAvatar($this->user->username);
}

return $this->user->getAvatar();
}

/**
* @since 6.3
*/
public function getCoverPhoto(): IUserCoverPhoto
{
if ($this->user->isHiddenBecauseBanned()) {
return $this->user->getDefaultCoverPhoto();
}

return $this->user->getCoverPhoto();
}

public function canEditUser(): bool
{
return $this->user->canEdit() || (WCF::getUser()->userID === $this->user->userID && $this->user->canEditOwnProfile());
Expand Down
1 change: 1 addition & 0 deletions wcfsetup/install/lang/de.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5388,6 +5388,7 @@ Benachrichtigungen auf <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|phra
<item name="wcf.user.profile.recentActivity.profileCommentResponse"><![CDATA[<strong>{$author}</strong> hat auf einen Kommentar von <strong>{$commentAuthor}</strong> an der <strong>Pinnwand von {$user}</strong> geantwortet.]]></item>
<item name="wcf.user.profile.report"><![CDATA[Benutzerprofil melden]]></item>
<item name="wcf.user.profile.protected"><![CDATA[Der Benutzer hat den Zugriff auf sein vollständiges Profil eingeschränkt.]]></item>
<item name="wcf.user.profile.banned"><![CDATA[Der Benutzer wurde gesperrt, sein Profil ist nicht verfügbar.]]></item>
<item name="wcf.user.profile.management"><![CDATA[Verwaltung]]></item>
<item name="wcf.user.profile.title"><![CDATA[Benutzerprofil von {$user->username}]]></item>
</category>
Expand Down
1 change: 1 addition & 0 deletions wcfsetup/install/lang/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5383,6 +5383,7 @@ your notifications on <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|phras
<item name="wcf.user.profile.recentActivity.profileCommentResponse"><![CDATA[<strong>{$author}</strong> replied to a comment by <strong>{$commentAuthor}</strong> on <strong>{$user}’s wall</strong>.]]></item>
<item name="wcf.user.profile.report"><![CDATA[Report User Profile]]></item>
<item name="wcf.user.profile.protected"><![CDATA[This member limits who may view their full profile.]]></item>
<item name="wcf.user.profile.banned"><![CDATA[This member has been banned, their profile is not available.]]></item>
<item name="wcf.user.profile.management"><![CDATA[Management]]></item>
<item name="wcf.user.profile.title"><![CDATA[User profile of {$user->username}]]></item>
</category>
Expand Down
Loading