Ok here is the DL link for the Reaction Plug and here are the instructions for installing it (also included in the zip file). Please read through the entire thing before starting. I think its a pretty easy add and i've tested it on my website which is running :
XOOPS Version XOOPS 2.5.11-Beta1
PHP Version 7.4.14
mySQL Version 5.5.68-MariaDB
That being said, use at your own risk and peril.
ReactionPlugin Download Instructions for installing the Reactions Plug-In:These instructions are for installing into NEWBB, but the premise and file locations should be similar for each module. Please adapt as you see fit and test this on a non-production website before deploying.
Copy this entire directory to the root of the /modules/newbb folder
So it the files should end up in the following locations:
/modules/newbb/Reaction.php
/modules/newbb/class/ReactionDBCreator.php
/modules/newbb/class/ReactionEntry.php
/modules/newbb/class/ReactionUsers.php
/modules/newbb/class/ReactUpdate.php
/modules/newbb/class/ReactionEntryHandler.php
/modules/newbb/class/ReactionInfo.php
/modules/newbb/include/AddReact.js
/modules/newbb/images/Like.png
/modules/newbb/images/Love.png
/modules/newbb/images/Hug.png
/modules/newbb/images/Laugh.png
/modules/newbb/images/Wow.png
/modules/newbb/images/Sad.png
/modules/newbb/images/Hate.png
You can modify the ReactionInfo.php file to add additional reaction or remove ones you don't want by modifying the define("ReactionNames", array("Like","Love","Hug","Laugh","Wow","Sad","Hate")); constant. The names much match the base names in the images folder.
You can change the DB Table name by modifying the define("ReactionTableName", "reaction_entry");
The table prefix is automatically added. Only 1 table is needed regardless of how many modules may be using it. So this is why the table name does not include a module name.
Once you have the DB Table name how you want it, run the /modules/newbb/class/ReactionDBCreator.php to create the table. This only had to be done once. You can delete this file afterward if you wish. But it checks if the table already exists and bails out if it does. So there is no danger to leaving it.
We need to manually modify 2 of the newbb files to support this. Please backup your files in the event you need to roll back or want to remove this plugin.
Modifications needed to NEWBB files:In file: /modules/newbb/include/images.php , around 46 change it from:
$forumImage['previous'] = $forumImage['next'] = $forumImage['right'] = $forumImage['down'] = $forumImage['up'] = $forumImage['printer'] = $forumImage['new_forum'] =
To:
$forumImage['previous'] = $forumImage['next'] = $forumImage['right'] = $forumImage['down'] = $forumImage['up'] = $forumImage['printer'] = $forumImage['react'] = $forumImage['new_forum'] =
Make sure the = (equal) signs are present above at the end of the line.
In file: /modules/newbb/class/Post.php ,around line 648 insert the following line:
//Added to support Reaction
include_once($GLOBALS['xoops']->path('modules/newbb/Reaction.php'));
$thread_action['react']['text'] = BuildButtonsForm($post_id);
So when done it should look something like the following.
if ($topicHandler->getPermission($forum_id, $topic_status, 'print')) {
$thread_action['print']['image'] = newbbDisplayImage('printer', _MD_NEWBB_PRINT);
$thread_action['print']['link'] = XOOPS_URL . '/modules/newbb/print.php?form=2&forum=' . $forum_id . '&topic_id=' . $topic_id;
$thread_action['print']['name'] = _MD_NEWBB_PRINT;
$thread_action['print']['target'] = '_blank';
}
//Added to support Reaction
include_once($GLOBALS['xoops']->path('modules/newbb/Reaction.php'));
$thread_action['react']['text'] = BuildButtonsForm($post_id);
if ($GLOBALS['xoopsModuleConfig']['show_sociallinks']) {
$full_title = $this->getVar('subject');
$clean_title = preg_replace('/[^A-Za-z0-9-]+/', '+', $this->getVar('subject'));
Basically, we are inserting it on the post footer between the print button and the social links. But if you wanted to move it, you could.
And that should be it. Once this is all in place, you should see the row of reaction icons at the bottom of each post when viewing a thread. Anytime a post has a reaction to it, it will show a (#) after the row icons to show how many reactions it has. Click on that opens a pop-up that shows what users reacted to it and how they reacted.
If you are a logged-in user, you can click any of the Icon to set your reaction to a post. That icon should show about 1/3rd larger to denote that if your reaction to it. If click another reaction on the same post, then it will reset to the new one. If you select the denoted icon, remove your reaction. You can only have 1 reaction to a single post.
If you look at the code added to the Post.php, the call to BuildButtonsForm does all the work for building the icons. You pass in the PostID that is how it knows what post you are on and uses that to store the value in the database.
So this can easily be added to another module. The code automatically detects what module it is installed under and uses that module's ID when storing reactions in the database. so only one table is needed regardless of the number of modules using it.
Hope this is helpful
-BigKev73