FoxSecrets
Active member
I implemented reactions in my addon content, everything is working fine except the selected option after page reload.
I hit like, I have the infos in db, I can list all reactions, etc.
The only missing thing is the reaction I clicked, I can't see back into the Like button after page reloads, it shows the original button.
So my question is: how can I see the selected reaction back to the button?
Controller:
I hit like, I have the infos in db, I can list all reactions, etc.
The only missing thing is the reaction I clicked, I can't see back into the Like button after page reloads, it shows the original button.
So my question is: how can I see the selected reaction back to the button?
Controller:
Code:
public function actionReact(ParameterBag $params)
{
$mycontent = $this->assertContentExists($params->mycontent_id);
/** @var \XF\ControllerPlugin\Reaction $reactionPlugin */
$reactionPlugin = $this->plugin('XF:Reaction');
return $reactionPlugin->actionReactSimple($mycontent, 'my-content');
}
public function actionReactions(ParameterBag $params)
{
$mycontent = $this->assertContentExists($params->profile_id);
$title = \XF::phrase('who_reacted_x', ['mycontent' => ($mycontent->username)]);
/** @var \XF\ControllerPlugin\Reaction $reactionPlugin */
$reactionPlugin = $this->plugin('XF:Reaction');
return $reactionPlugin->actionReactions(
$mycontent,
'my-content/reactions',
$title
);
}