*/
protected $signatures = [];
+ /**
+ * The userIDs which are cached by the message embedded object manager.
+ * @var integer[]
+ */
+ protected $cachedUserIDs = [];
+
/**
* Returns a parsed user signature.
*
$this->htmlOutputProcessor = new HtmlOutputProcessor();
}
- MessageEmbeddedObjectManager::getInstance()->loadObjects('com.woltlab.wcf.user.signature', [$user->userID]);
+ if (!in_array($user->userID, $this->cachedUserIDs)) {
+ $this->cacheUserSignature([$user->userID]);
+ }
$this->htmlOutputProcessor->setContext('com.woltlab.wcf.user.signature', $user->userID);
$this->htmlOutputProcessor->process($user->signature, 'com.woltlab.wcf.user.signature', $user->userID);
return $this->signatures[$user->userID];
}
+
+ /**
+ * Loads the embedded objects for the given users.
+ *
+ * @param integer[] $userIDs
+ * @since 5.2
+ */
+ public function cacheUserSignature(array $userIDs) {
+ $this->cachedUserIDs = array_merge($this->cachedUserIDs, $userIDs);
+
+ MessageEmbeddedObjectManager::getInstance()->loadObjects('com.woltlab.wcf.user.signature', $userIDs);
+ }
}