Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 14 additions & 2 deletions unmus_activitypub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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='<p><a href="https://www.unmus.de/@blog" rel="ugc">@blog</a> ';

$pos=strpos($comment_text, $handle);
Expand All @@ -36,6 +38,16 @@ function unmus_federated_comment_remove_account( $comment_text, $comment = null
$comment_text = substr_replace($comment_text, '<p>', $pos, strlen($handle));
}

// Mentions

$mention='<a href="https://www.unmus.de/@blog" rel="ugc">@blog</a> ';

$pos=strpos($comment_text, $mention);

if ($pos !== false) {
$comment_text = substr_replace($comment_text, '', $pos, strlen($mention));
}

return $comment_text;

}
Expand Down