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

Filter type of WebMentions to be allowed #267

Open
@edent

Description

@edent

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions