• Resolved kennethrg

    (@kennethrg)


    ActivityPub and ATmosphere plugins use the comments table for likes and reposts, and intend for those comments to be displayed differently on the frontend. For wpDiscuz to work properly with these plugins, it should not display comments with comment_type="like" or comment_type="repost" alongside comments of type comment. Is this possible?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support gVectors Support

    (@gvectorssupport)

    Sorry for the late response.

    You should handle this using the native WordPress hooks that get comments.

    Thread Starter kennethrg

    (@kennethrg)

    Thanks. I am not the plugin author, but looking at the ActivityPub plugin it appears to be using the native comment_feed_where hook to add an appropriate comment_type filter if none is present. Does wpDiscuz do its own comment_type filtering?

    Plugin Support gVectors Support

    (@gvectorssupport)

    Please try using the following code:

    if (!function_exists('exclude_activitypub_comment_types')) {
        function exclude_activitypub_comment_types() {
            return ['like', 'repost'];
        }
    }
    
    add_filter('wpdiscuz_comments_args', function ($args) {
        $args['type__not_in'] = array_merge(
            (array) ($args['type__not_in'] ?? []),
            exclude_activitypub_comment_types()
        );
    
        return $args;
    });
    
    add_filter('wpdiscuz_found_comments_query', function ($notIn) {
        return array_merge((array) $notIn, exclude_activitypub_comment_types());
    });

    Insert this code into your active theme’s functions.php file.

    You can find instructions on how to safely add custom PHP code to WordPress here:

    https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/

    Thread Starter kennethrg

    (@kennethrg)

    It looks like that’s doing it. Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.