</bbcode>
<bbcode name="user">
<classname>wcf\system\bbcode\UserBBCode</classname>
+ <sourcecode>1</sourcecode>
<attributes>
<attribute name="0">
<validationpattern><![CDATA[^\d+$]]></validationpattern>
</attributes>
</bbcode>
<bbcode name="group">
+ <sourcecode>1</sourcecode>
<classname>wcf\system\bbcode\GroupBBCode</classname>
<attributes>
<attribute name="0">
{if $group}
<span class="groupMention">{$group->getName()}</span>
{else}
- @{$groupName}
+ {$groupName}
{/if}
{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}
<a href="{link controller='User' object=$userProfile->getDecoratedObject()}{/link}" class="userMention userLink" data-object-id="{@$userProfile->userID}">{@$userProfile->getFormattedUsername()}</a>{* no newline after the tag
*}{/if}
{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}
<a href="{link controller='User' object=$userProfile->getDecoratedObject()}{/link}" class="userMention userLink" data-object-id="{@$userProfile->userID}">{@$userProfile->getFormattedUsername()}</a>{* no newline after the tag
*}{/if}
*/
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', [
*/
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 */