{/if}
{if $__wcf->user->userID && $user->userID != $__wcf->user->userID}
- {if !$user->isIgnoredUser($__wcf->user->userID)}
+ {if !$__wcf->getUserProfileHandler()->isIgnoredByUser($user->userID)}
{if $__wcf->getUserProfileHandler()->isFollowing($user->userID)}
<li class="jsOnly"><a href="#" data-following="1" data-object-id="{@$user->userID}" class="jsFollowButton jsTooltip" title="{lang}wcf.user.button.unfollow{/lang}"><span class="icon icon16 fa-minus"></span> <span class="invisible">{lang}wcf.user.button.unfollow{/lang}</span></a></li>
{else}
*/
protected $ignoredUserIDs;
+ /**
+ * list of user ids that are ignoring this user
+ * @var integer[]
+ */
+ protected $ignoredByUserIDs;
+
/**
* list of follower user ids
* @var integer[]
return $this->ignoredUserIDs;
}
+ /**
+ * Returns a list of user ids that are ignoring this user.
+ *
+ * @return integer[]
+ */
+ public function getIgnoredByUsers() {
+ if ($this->ignoredByUserIDs === null) {
+ $this->ignoredByUserIDs = [];
+
+ if ($this->userID) {
+ // get ids
+ $data = UserStorageHandler::getInstance()->getField('ignoredByUserIDs', $this->userID);
+
+ // cache does not exist or is outdated
+ if ($data === null) {
+ $sql = "SELECT userID
+ FROM wcf".WCF_N."_user_ignore
+ WHERE ignoreUserID = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute([$this->userID]);
+ $this->ignoredByUserIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
+
+ // update storage data
+ UserStorageHandler::getInstance()->update($this->userID, 'ignoredByUserIDs', serialize($this->ignoredByUserIDs));
+ }
+ else {
+ $this->ignoredByUserIDs = unserialize($data);
+ }
+ }
+ }
+
+ return $this->ignoredByUserIDs;
+ }
+
/**
* Returns true if current user is following given user id.
*
/**
* Returns true if given user is ignored.
- *
+ *
* @param integer $userID
* @return boolean
*/
return in_array($userID, $this->getIgnoredUsers());
}
+ /**
+ * Returns true if the given user ignores the current user.
+ *
+ * @param integer $userID
+ * @return boolean
+ */
+ public function isIgnoredByUser($userID) {
+ return in_array($userID, $this->getIgnoredByUsers());
+ }
+
/**
* Returns the user's avatar.
*