Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Filter type of WebMentions to be allowed #267

Open
edent opened this issue Dec 4, 2022 · 1 comment
Open

Filter type of WebMentions to be allowed #267

edent opened this issue Dec 4, 2022 · 1 comment
Labels

Comments

@edent
Copy link

edent commented Dec 4, 2022

As discussed in pfefferle/wordpress-webmention#343 and snarfed/bridgy#1347 - I only want to see replies and mentions of my blog posts, I don't want likes, retweets, boosts, reactjis etc.

This can be set in

public static function enhance( $commentdata, $comment = array(), $commentarr = array() ) {

Which is called from

add_filter( 'preprocess_comment', array( 'Linkbacks_Handler', 'enhance' ), 0, 1 );

Once the comment has been pre-processed, but before it is returned, the following can be added to enhance():

if ( isset( $commentdata['comment_meta']['semantic_linkbacks_type'] ) ) {
	$comment_type = $commentdata['comment_meta']['semantic_linkbacks_type'];

	if ( "mention" == $comment_type || "reply" == $comment_type ) {
		//  Do nothing
	} else {
		error_log("Deleting a " . $comment_type);
		die("Comment not enhanced");
	}	
}

Because the function dies, the comment is never enhanced and doesn't appear in the moderation queue.

This is a quick hack. For production, it would probably need a UI to let users specify what sort of semantic linkbacks they're interested in.

@stale
Copy link

stale bot commented Apr 4, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant