<admindefaultvalue>1</admindefaultvalue>
</option>
+ <option name="user.profile.avatar.canSeeAvatars">
+ <categoryname>user.profile.avatar</categoryname>
+ <optiontype>boolean</optiontype>
+ <defaultvalue>1</defaultvalue>
+ </option>
<option name="user.profile.avatar.canUploadAvatar">
<categoryname>user.profile.avatar</categoryname>
<optiontype>boolean</optiontype>
public function getAvatar() {
if ($this->avatar === null) {
if (!$this->disableAvatar) {
- if ($this->avatarID) {
- if (!$this->fileHash) {
- // load storage data
- UserStorageHandler::getInstance()->loadStorage(array($this->userID));
- $data = UserStorageHandler::getInstance()->getStorage(array($this->userID), 'avatar');
-
- if ($data[$this->userID] === null) {
- $this->avatar = new UserAvatar($this->avatarID);
- UserStorageHandler::getInstance()->update($this->userID, 'avatar', serialize($this->avatar));
+ if ($this->canSeeAvatar()) {
+ if ($this->avatarID) {
+ if (!$this->fileHash) {
+ // load storage data
+ UserStorageHandler::getInstance()->loadStorage(array($this->userID));
+ $data = UserStorageHandler::getInstance()->getStorage(array($this->userID), 'avatar');
+
+ if ($data[$this->userID] === null) {
+ $this->avatar = new UserAvatar($this->avatarID);
+ UserStorageHandler::getInstance()->update($this->userID, 'avatar', serialize($this->avatar));
+ }
+ else {
+ $this->avatar = unserialize($data[$this->userID]);
+ }
}
else {
- $this->avatar = unserialize($data[$this->userID]);
+ $this->avatar = new UserAvatar(null, $this->getDecoratedObject()->data);
}
}
- else {
- $this->avatar = new UserAvatar(null, $this->getDecoratedObject()->data);
+ else if (MODULE_GRAVATAR && $this->enableGravatar) {
+ $this->avatar = new Gravatar($this->userID, $this->email);
}
}
- else if (MODULE_GRAVATAR && $this->enableGravatar) {
- $this->avatar = new Gravatar($this->userID, $this->email);
- }
}
// use default avatar
return $this->avatar;
}
+ /**
+ * Returns true if the active user can view the avatar of this user.
+ *
+ * @return boolean
+ */
+ public function canSeeAvatar() {
+ return (WCF::getUser()->userID == $this->userID || WCF::getSession()->getPermission('user.profile.avatar.canSeeAvatars'));
+ }
+
/**
* Returns true if this user is currently online.
*
<item name="wcf.acp.group.option.category.admin.user.rank"><![CDATA[Benutzerränge]]></item>
<item name="wcf.acp.group.option.category.user.signature"><![CDATA[Signaturen]]></item>
<item name="wcf.acp.group.option.user.profile.avatar.allowedFileExtensions"><![CDATA[Erlaubte Dateiendungen]]></item>
+ <item name="wcf.acp.group.option.user.profile.avatar.canSeeAvatars"><![CDATA[Kann Avatare anderer Benutzer sehen]]></item>
<item name="wcf.acp.group.option.user.profile.avatar.canUploadAvatar"><![CDATA[Kann eigenen Avatar hochladen]]></item>
<item name="wcf.acp.group.option.user.profile.avatar.maxSize"><![CDATA[Maximale Dateigröße]]></item>
<item name="wcf.acp.group.option.user.profile.canChangeEmail"><![CDATA[Kann E-Mail-Adresse ändern]]></item>
<item name="wcf.acp.group.option.category.admin.user.rank"><![CDATA[User Ranks]]></item>
<item name="wcf.acp.group.option.category.user.signature"><![CDATA[Signatures]]></item>
<item name="wcf.acp.group.option.user.profile.avatar.allowedFileExtensions"><![CDATA[Allowed File Extensions]]></item>
+ <item name="wcf.acp.group.option.user.profile.avatar.canUploadAvatar"><![CDATA[Can see avatars of other users]]></item>
<item name="wcf.acp.group.option.user.profile.avatar.canUploadAvatar"><![CDATA[Can upload own avatar]]></item>
<item name="wcf.acp.group.option.user.profile.avatar.maxSize"><![CDATA[Maximimum File Size]]></item>
<item name="wcf.acp.group.option.user.profile.canChangeEmail"><![CDATA[Can change email address]]></item>