Support embedded objects in users' "About Me" text (#4282)
authorMatthias Schmidt <gravatronics@live.com>
Mon, 14 Jun 2021 09:26:19 +0000 (11:26 +0200)
committerGitHub <noreply@github.com>
Mon, 14 Jun 2021 09:26:19 +0000 (11:26 +0200)
See #4253

wcfsetup/install/files/lib/system/option/user/MessageUserOptionOutput.class.php

index d4d48ef8cbcf73d3c8b13f0744d4b581d471c354..2e2174b317ed17e8502429e9b6cc2e2859622eb3 100644 (file)
@@ -4,7 +4,9 @@ namespace wcf\system\option\user;
 
 use wcf\data\user\option\UserOption;
 use wcf\data\user\User;
+use wcf\system\html\input\HtmlInputProcessor;
 use wcf\system\html\output\HtmlOutputProcessor;
+use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
 use wcf\system\WCF;
 use wcf\util\StringUtil;
 
@@ -28,6 +30,14 @@ class MessageUserOptionOutput implements IUserOptionOutput
             return '';
         }
 
+        // Load embedded objects by parsing the original message again because for the user options, there
+        // is no central way to save the embedded objects in the database.
+        $htmlInputProcessor = new HtmlInputProcessor();
+        $htmlInputProcessor->setContext('com.woltlab.wcf.user.aboutMe', $user->userID);
+        $htmlInputProcessor->processIntermediate($value);
+        $htmlInputProcessor->processEmbeddedContent($value, 'com.woltlab.wcf.user.aboutMe', $user->userID);
+        MessageEmbeddedObjectManager::getInstance()->registerTemporaryMessage($htmlInputProcessor);
+
         $htmlOutputProcessor = new HtmlOutputProcessor();
         $htmlOutputProcessor->process($value, 'com.woltlab.wcf.user.aboutMe', $user->userID);