Customize Reactions
Quote from Heatherlly on May 19, 2018, 4:34 pmWhen the reactions feature was first released, I modified the code to remove the negative option (just wanted a like button). Now the code has changed and I can’t figure out how to do it anymore. Can you help?
Thanks!
When the reactions feature was first released, I modified the code to remove the negative option (just wanted a like button). Now the code has changed and I can’t figure out how to do it anymore. Can you help?
Thanks!
Quote from Asgaros on May 19, 2018, 8:08 pmHello @heatherlly
Can you post the code you used before so I can have a look?
Hello @heatherlly
Can you post the code you used before so I can have a look?
Quote from Heatherlly on May 21, 2018, 1:31 pmI’m sorry. I wrote over the old file and I don’t have a backup, it seems. I know I made a direct change to the HTML, though – I just removed the code that displayed the down arrow.
Now the code looks like this:
foreach ($this->reactions_list as $reaction) { $counter = (isset($this->post_reactions[$post_id][$reaction])) ? number_format_i18n(count($this->post_reactions[$post_id][$reaction])) : 0; $output = '<span class="reaction '.$reaction.'"><span class="reaction-icon dashicons-before dashicons-thumbs-'.$reaction.' '.$active[$reaction].'"></span><span class="reaction-number">'.$counter.'</span></span>';The newer versions are written to accommodate either reaction. It’s no longer a separate bit of code for each, which is why I can’t remove it anymore.
If there’s no easy fix, I completely understand. Just thought it was worth asking.
I’m sorry. I wrote over the old file and I don’t have a backup, it seems. I know I made a direct change to the HTML, though – I just removed the code that displayed the down arrow.
Now the code looks like this:
foreach ($this->reactions_list as $reaction) { $counter = (isset($this->post_reactions[$post_id][$reaction])) ? number_format_i18n(count($this->post_reactions[$post_id][$reaction])) : 0; $output = '<span class="reaction '.$reaction.'"><span class="reaction-icon dashicons-before dashicons-thumbs-'.$reaction.' '.$active[$reaction].'"></span><span class="reaction-number">'.$counter.'</span></span>';
The newer versions are written to accommodate either reaction. It’s no longer a separate bit of code for each, which is why I can’t remove it anymore.
If there’s no easy fix, I completely understand. Just thought it was worth asking.
Quote from Asgaros on May 21, 2018, 8:09 pmHello @heatherlly
I think there is a relatively simple workaround for this. In the file /includes/forum-reactions.php somewhere at the beginning you will find the following line:
private $reactions_list = array('down', 'up');Just change it to this:
private $reactions_list = array('up');That should be all. 🙂
Hello @heatherlly
I think there is a relatively simple workaround for this. In the file /includes/forum-reactions.php somewhere at the beginning you will find the following line:
private $reactions_list = array('down', 'up');
Just change it to this:
private $reactions_list = array('up');
That should be all. 🙂
Quote from Heatherlly on May 21, 2018, 8:31 pmWorks like a charm. Thank you so much!
Works like a charm. Thank you so much!