diff --git a/readme.md b/readme.md index d022eae..7609859 100644 --- a/readme.md +++ b/readme.md @@ -220,6 +220,7 @@ Release pending. * Added: Fade out WB REST CACHE Icon @ Admin Bar * Added: Disable UpdraftPlus @ Admin Bar * Fixed: Content Type Return @ WP REST CACHE +* Changed: Remove Mastodon Account @ Federated Comment extended with Mentions ### 0.8 diff --git a/unmus_activitypub.php b/unmus_activitypub.php index 6b6283c..e1d12ef 100644 --- a/unmus_activitypub.php +++ b/unmus_activitypub.php @@ -11,10 +11,10 @@ if (!defined('ABSPATH')) { exit; } /** - * Remove Mastodon Blog Account @ Federated Comment + * Remove Mastodon Account @ Federated Comment * - * Initial content remains unchanged. * Filter will be applied before display. + * Original comment remains unchanged in database. * * @since 0.8 * @@ -28,6 +28,8 @@ function unmus_federated_comment_remove_account( $comment_text, $comment = null // Check is required to avoid execution before database insert if ($comment !== null) { + // Reply + $handle='
@blog '; $pos=strpos($comment_text, $handle); @@ -36,6 +38,16 @@ function unmus_federated_comment_remove_account( $comment_text, $comment = null $comment_text = substr_replace($comment_text, '
', $pos, strlen($handle)); } + // Mentions + + $mention='@blog '; + + $pos=strpos($comment_text, $mention); + + if ($pos !== false) { + $comment_text = substr_replace($comment_text, '', $pos, strlen($mention)); + } + return $comment_text; }