diff --git a/com.woltlab.wcf/templates/userCard.tpl b/com.woltlab.wcf/templates/userCard.tpl
index 096fd255891..674b8765f32 100644
--- a/com.woltlab.wcf/templates/userCard.tpl
+++ b/com.woltlab.wcf/templates/userCard.tpl
@@ -100,6 +100,11 @@
{/if}
{/if}
+ {foreach from=$user->getUserCardOptions() item=userCardOption}
+
{$userCardOption->getTitle()}
+ {unsafe:$userCardOption->optionValue}
+ {/foreach}
+
{event name='afterDetails'}
{/content}
diff --git a/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.3_step1.php b/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.3_step1.php
index 098f111ae53..4665105befd 100644
--- a/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.3_step1.php
+++ b/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.3_step1.php
@@ -50,5 +50,9 @@
->defaultValue(0)
->drop(),
JsonDatabaseTableColumn::create('cachedReactions'),
- ])
+ ]),
+ PartialDatabaseTable::create('wcf1_user_option')
+ ->columns([
+ DefaultFalseBooleanDatabaseTableColumn::create('showOnUserCard'),
+ ]),
];
diff --git a/wcfsetup/install/files/lib/acp/form/UserOptionAddForm.class.php b/wcfsetup/install/files/lib/acp/form/UserOptionAddForm.class.php
index 0a8d6021675..a4ba4e372e1 100644
--- a/wcfsetup/install/files/lib/acp/form/UserOptionAddForm.class.php
+++ b/wcfsetup/install/files/lib/acp/form/UserOptionAddForm.class.php
@@ -258,6 +258,9 @@ public function createForm()
BooleanFormField::create('searchable')
->label('wcf.acp.user.option.searchable')
->value(false),
+ BooleanFormField::create('showOnUserCard')
+ ->label('wcf.acp.user.option.showOnUserCard')
+ ->value(false),
])
]);
}
diff --git a/wcfsetup/install/files/lib/data/user/UserProfile.class.php b/wcfsetup/install/files/lib/data/user/UserProfile.class.php
index 505e5f5d7e0..972f78edf77 100644
--- a/wcfsetup/install/files/lib/data/user/UserProfile.class.php
+++ b/wcfsetup/install/files/lib/data/user/UserProfile.class.php
@@ -18,6 +18,7 @@
use wcf\data\user\ignore\UserIgnore;
use wcf\data\user\online\UserOnline;
use wcf\data\user\option\ViewableUserOption;
+use wcf\system\cache\builder\UserOptionCacheBuilder;
use wcf\data\user\rank\UserRank;
use wcf\system\cache\builder\UserGroupPermissionCacheBuilder;
use wcf\system\cache\builder\UserRankCacheBuilder;
@@ -47,7 +48,7 @@
* @property-read string $birthday
* @extends DatabaseObjectDecorator
*/
-class UserProfile extends DatabaseObjectDecorator implements ITitledLinkObject
+class UserProfile extends DatabaseObjectDecorator implements ITitledLinkObject, \Stringable
{
/**
* @inheritDoc
@@ -1102,6 +1103,44 @@ public function isVisibleOption(string $name)
return $option->isVisible();
}
+ /**
+ * Returns the list of user options that should be displayed on the user card.
+ *
+ * @return ViewableUserOption[]
+ * @since 6.3
+ */
+ public function getUserCardOptions(): array
+ {
+ $options = UserOptionCacheBuilder::getInstance()->getData([], 'options');
+
+ $result = [];
+ foreach ($options as $option) {
+ if (!$option->showOnUserCard) {
+ continue;
+ }
+
+ $rawValue = $this->getUserOption($option->optionName);
+ if ($rawValue === null || $rawValue === '') {
+ continue;
+ }
+
+ $viewableOption = ViewableUserOption::getUserOption($option->optionName);
+ $viewableOption->setUser($this->getDecoratedObject());
+ if (!$viewableOption->isVisible()) {
+ continue;
+ }
+
+ $viewableOption->setOptionValue($this->getDecoratedObject());
+ if ($viewableOption->optionValue === '' || $viewableOption->optionValue === null) {
+ continue;
+ }
+
+ $result[] = $viewableOption;
+ }
+
+ return $result;
+ }
+
/**
* Returns the formatted username.
*
diff --git a/wcfsetup/install/files/lib/data/user/option/UserOption.class.php b/wcfsetup/install/files/lib/data/user/option/UserOption.class.php
index 0becb178a94..678dae9132b 100644
--- a/wcfsetup/install/files/lib/data/user/option/UserOption.class.php
+++ b/wcfsetup/install/files/lib/data/user/option/UserOption.class.php
@@ -24,6 +24,7 @@
* @property-read 0|1 $isDisabled is `1` if the user option is disabled and thus neither shown nor editable, otherwise `0`
* @property-read 0|1 $originIsSystem is `1` if the user option was created by the system and not manually by an administrator, otherwise `0`
* @property-read string $labeledUrl the url, if the option type is `labeledUrl`
+ * @property-read 0|1 $showOnUserCard is `1` if the user option should be displayed on the user card, otherwise `0`
*/
class UserOption extends Option implements ITitledObject
{
diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml
index a03805d1a16..5a7aec96035 100644
--- a/wcfsetup/install/lang/de.xml
+++ b/wcfsetup/install/lang/de.xml
@@ -3148,6 +3148,7 @@ Abschnitte dürfen nicht leer sein und nur folgende Zeichen enthalten: [a-z
+
diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml
index dfbd2cc2dac..7f1c156c221 100644
--- a/wcfsetup/install/lang/en.xml
+++ b/wcfsetup/install/lang/en.xml
@@ -3075,6 +3075,7 @@ If you have already bought the licenses for the listed apps, th
+
diff --git a/wcfsetup/setup/db/install_com.woltlab.wcf.php b/wcfsetup/setup/db/install_com.woltlab.wcf.php
index 311f3134910..3f8939f1e59 100644
--- a/wcfsetup/setup/db/install_com.woltlab.wcf.php
+++ b/wcfsetup/setup/db/install_com.woltlab.wcf.php
@@ -4616,6 +4616,7 @@
TextDatabaseTableColumn::create('options'),
MediumtextDatabaseTableColumn::create('additionalData'),
DefaultFalseBooleanDatabaseTableColumn::create('originIsSystem'),
+ DefaultFalseBooleanDatabaseTableColumn::create('showOnUserCard'),
])
->indices([
DatabaseTablePrimaryIndex::create()