Clanbite Social Kit Social Since 1.6.2

apply_filters( 'clanbite_social_kit_can_react', bool $allow, string $object_type, int $object_id, int $user_id, string $slug )

Filters whether a user may apply a reaction to an object. The single permission hook for every surface.

Runs after the object type's own check, for posts, comments, forum topics and replies and anything an add-on registers. Use $object_type to target one kind of content.

Filter PHP

Parameters

$allow (bool)

Whether the reaction is allowed.

$object_type (string)

Registered object type (social_post, social_comment, forum_topic, forum_reply…).

$object_id (int)

Object ID.

$user_id (int)

Reacting user.

$slug (string)

Reaction type slug.

Example

add_filter( 'clanbite_social_kit_can_react', function ( $allow, $object_type, $object_id, $user_id, $slug ) {
	// Change $allow here.
	return $allow;
}, 10, 5 );

Defined in inc/Social/Reactions.php

Changelog

VersionDescription
1.6.2Introduced.