Skip to content

Reactions Filters

4 unique filter hooks currently map to this category, across 5 call sites.

Hook Inventory

HookEditionCall SitesFirst Source
fluent_community/feed/updated_survey_configCore1fluent-community/app/Services/FeedsHelper.php:428
fluent_community/reactions_api_responseCore2fluent-community/app/Http/Controllers/ReactionController.php:39
fluent_community/survey_config_responseCore1fluent-community/app/Http/Controllers/ReactionController.php:196
fluent_community/survey_voters_api_responseCore1fluent-community/app/Http/Controllers/ReactionController.php:223

fluent_community/feed/updated_survey_config

  • Type: filter
  • Edition: Core
  • Call sites: 1
  • When it fires: Filters a survey's configuration after vote tallies have been recalculated but before it is stored.

The returned array is written straight into the post's meta.survey_config and saved, so this is the persistence-side hook — mutating options[*].vote_counts here changes the stored tallies. It runs on every ballot submission, including one that only withdraws votes. For a display-only change use fluent_community/survey_config_response, which runs afterwards and is not persisted.

Parameters

#NameTypeDescription
1$surveyConfigarrayThe survey configuration, including options with recalculated vote_counts, and end_date.
2$feed\FluentCommunity\App\Models\FeedThe survey post.
3$userIdintWordPress user ID of the voter.

Return: array — the configuration, written verbatim to meta.survey_config.

Call Sites

EditionSourceParameters
Corefluent-community/app/Services/FeedsHelper.php:428$surveyConfig (mixed)
$feed (Feed)
$userId (int)

Example

php
add_filter('fluent_community/feed/updated_survey_config', function ($surveyConfig, $feed, $userId) {
    return $surveyConfig;
}, 10, 3);

Related: fluent_community/survey_config_response · fluent_community/feed/cast_survey_vote

fluent_community/reactions_api_response

  • Type: filter
  • Edition: Core
  • Call sites: 2
  • When it fires: Filters the list of members who liked a post or a comment.

One filter for both endpoints: GET /feeds/{id}/reactions and GET /comments/{id}/reactions. Nothing in the arguments distinguishes them, so inspect the reactions themselves if you need to. Only like reactions are returned, capped at 100 rows with no paging, and reactions whose profile is missing are excluded.

Parameters

#NameTypeDescription
1$dataarrayResponse payload with a reactions collection.
2$reactions\FluentCommunity\Framework\Database\Orm\CollectionThe reactions, with xprofile eager-loaded.
3$requestDataarrayThe full request parameters.

Return: The response payload array.

Call Sites

EditionSourceParameters
Corefluent-community/app/Http/Controllers/ReactionController.php:39[ 'reactions' => $reactions ] (array)
$reactions (mixed)
$request->all() (array)
Corefluent-community/app/Http/Controllers/ReactionController.php:72[ 'reactions' => $reactions ] (array)
$reactions (mixed)
$request->all() (array)

Example

php
add_filter('fluent_community/reactions_api_response', function ($data, $reactions, $requestData) {
    return $data;
}, 10, 3);

Related: fluent_community/survey_voters_api_response

fluent_community/survey_config_response

  • Type: filter
  • Edition: Core
  • Call sites: 1
  • When it fires: Filters the survey configuration returned to the voter after a ballot is cast.

Applied to the response only — unlike fluent_community/feed/updated_survey_config nothing here is persisted. It runs after the reload that marks the current voter's own choices with voted = true on each matching option, so it is the right place to adjust what a voter is shown without changing the stored tallies. It only runs on the vote endpoint; a survey rendered as part of a normal feed fetch does not pass through it.

Parameters

#NameTypeDescription
1$surveyConfigarrayThe survey configuration with the voter's own voted flags applied.
2$feed\FluentCommunity\App\Models\FeedThe survey post.
3$userIdintWordPress user ID of the voter.

Return: The survey configuration array, returned under a survey_config key.

Call Sites

EditionSourceParameters
Corefluent-community/app/Http/Controllers/ReactionController.php:196$surveyConfig (mixed)
$feed (Feed)
$userId (int)

Example

php
add_filter('fluent_community/survey_config_response', function ($surveyConfig, $feed, $userId) {
    return $surveyConfig;
}, 10, 3);

Related: fluent_community/feed/updated_survey_config

fluent_community/survey_voters_api_response

  • Type: filter
  • Edition: Core
  • Call sites: 1
  • When it fires: Filters the list of members who voted for one survey option.

The option is identified by its slug, which is stored in the reaction's object_type column. Capped at 100 voters with no paging, and voters without a profile row are excluded. Access is checked against the parent post, not against the survey — anyone who can read the post can enumerate its voters.

Parameters

#NameTypeDescription
1$dataarrayResponse payload with a voters collection.
2$requestDataarrayThe full request parameters.

Return: The response payload array.

Call Sites

EditionSourceParameters
Corefluent-community/app/Http/Controllers/ReactionController.php:223$data (mixed)
$this->request->all() (array)

Example

php
add_filter('fluent_community/survey_voters_api_response', function ($data, $requestData) {
    return $data;
}, 10, 2);

Related: fluent_community/reactions_api_response

FluentCommunity developer documentation