diff --git a/com.woltlab.wcf/bbcode.xml b/com.woltlab.wcf/bbcode.xml
index 074a6322e05..5f84ea27a5f 100644
--- a/com.woltlab.wcf/bbcode.xml
+++ b/com.woltlab.wcf/bbcode.xml
@@ -208,6 +208,7 @@
wcf\system\bbcode\UserBBCode
+ 1
@@ -232,6 +233,7 @@
+ 1
wcf\system\bbcode\GroupBBCode
diff --git a/com.woltlab.wcf/templates/groupBBCodeTag.tpl b/com.woltlab.wcf/templates/groupBBCodeTag.tpl
index 74ae8bfc523..177ae1c6128 100644
--- a/com.woltlab.wcf/templates/groupBBCodeTag.tpl
+++ b/com.woltlab.wcf/templates/groupBBCodeTag.tpl
@@ -1,5 +1,5 @@
{if $group}
{$group->getName()}
{else}
- @{$groupName}
+ {$groupName}
{/if}
diff --git a/com.woltlab.wcf/templates/userBBCodeTag.tpl b/com.woltlab.wcf/templates/userBBCodeTag.tpl
index dbe32b29d2a..369371df25c 100644
--- a/com.woltlab.wcf/templates/userBBCodeTag.tpl
+++ b/com.woltlab.wcf/templates/userBBCodeTag.tpl
@@ -1,6 +1,6 @@
{if $userProfile === null}
{* user no longer exists, use plain output rather than using a broken link *}
- @{$username}{* no newline after the tag
+ {$username}{* no newline after the tag
*}{else}
{@$userProfile->getFormattedUsername()}{* no newline after the tag
*}{/if}
diff --git a/wcfsetup/install/files/acp/templates/userBBCodeTag.tpl b/wcfsetup/install/files/acp/templates/userBBCodeTag.tpl
index dbe32b29d2a..369371df25c 100644
--- a/wcfsetup/install/files/acp/templates/userBBCodeTag.tpl
+++ b/wcfsetup/install/files/acp/templates/userBBCodeTag.tpl
@@ -1,6 +1,6 @@
{if $userProfile === null}
{* user no longer exists, use plain output rather than using a broken link *}
- @{$username}{* no newline after the tag
+ {$username}{* no newline after the tag
*}{else}
{@$userProfile->getFormattedUsername()}{* no newline after the tag
*}{/if}
diff --git a/wcfsetup/install/files/lib/system/bbcode/GroupBBCode.class.php b/wcfsetup/install/files/lib/system/bbcode/GroupBBCode.class.php
index 42160201b0c..a58e949029a 100644
--- a/wcfsetup/install/files/lib/system/bbcode/GroupBBCode.class.php
+++ b/wcfsetup/install/files/lib/system/bbcode/GroupBBCode.class.php
@@ -20,10 +20,15 @@ final class GroupBBCode extends AbstractBBCode
*/
public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser): string
{
- $groupID = (!empty($openingTag['attributes'][0])) ? \intval($openingTag['attributes'][0]) : 0;
+ $content = $openingTag['attributes'][0];
+ if (!\str_starts_with($content, '@')) {
+ $content = "@{$content}";
+ }
+
+ $groupID = (!empty($openingTag['attributes'][1])) ? \intval($openingTag['attributes'][1]) : 0;
$group = UserGroup::getGroupByID($groupID);
if ($group === null || !$group->canBeMentioned()) {
- return "[group]{$content}[/group]";
+ return $content;
}
return WCF::getTPL()->fetch('groupBBCodeTag', 'wcf', [
diff --git a/wcfsetup/install/files/lib/system/bbcode/UserBBCode.class.php b/wcfsetup/install/files/lib/system/bbcode/UserBBCode.class.php
index d96c4b5d2e9..33d3c1c82ea 100644
--- a/wcfsetup/install/files/lib/system/bbcode/UserBBCode.class.php
+++ b/wcfsetup/install/files/lib/system/bbcode/UserBBCode.class.php
@@ -21,9 +21,14 @@ final class UserBBCode extends AbstractBBCode
*/
public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser): string
{
- $userID = (!empty($openingTag['attributes'][0])) ? \intval($openingTag['attributes'][0]) : 0;
+ $content = $openingTag['attributes'][0];
+ if (!\str_starts_with($content, '@')) {
+ $content = "@{$content}";
+ }
+
+ $userID = (!empty($openingTag['attributes'][1])) ? \intval($openingTag['attributes'][1]) : 0;
if (!$userID) {
- return "[user]{$content}[/user]";
+ return $content;
}
/** @var UserProfile $userProfile */