diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php
index 2113c6fa2..61fe707b4 100644
--- a/src/Content/Text/BBCode.php
+++ b/src/Content/Text/BBCode.php
@@ -1488,14 +1488,6 @@ class BBCode extends BaseObject
$text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '', $text);
$text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '', $text);
- // Shared content
- $text = self::convertShare(
- $text,
- function (array $attributes, array $author_contact, $content, $is_quote_share) use ($simple_html) {
- return self::convertShareCallback($attributes, $author_contact, $content, $is_quote_share, $simple_html);
- }
- );
-
$text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism", '
', $text);
$text = preg_replace("/\[crypt(.*?)\](.*?)\[\/crypt\]/ism", '
', $text);
//$Text = preg_replace("/\[crypt=(.*?)\](.*?)\[\/crypt\]/ism", '
', $Text);
@@ -1731,6 +1723,14 @@ class BBCode extends BaseObject
$regex = '#<([^>]*?)(href)="(?!' . implode('|', $allowed_link_protocols) . ')(.*?)"(.*?)>#ism';
$text = preg_replace($regex, '<$1$2="javascript:void(0)"$4 data-original-href="$3" class="invalid-href" title="' . L10n::t('Invalid link protocol') . '">', $text);
+ // Shared content
+ $text = self::convertShare(
+ $text,
+ function (array $attributes, array $author_contact, $content, $is_quote_share) use ($simple_html) {
+ return self::convertShareCallback($attributes, $author_contact, $content, $is_quote_share, $simple_html);
+ }
+ );
+
if ($saved_image) {
$text = self::interpolateSavedImagesIntoItemBody($text, $saved_image);
}