Hi,
I have a problem: for logged users all is OK, but for non logged users Like Dislake not working, not counting, nothing happens.
Regards
]]>Hey there,
thanks for the nice plugin! Unfortunately, I am facing an issue when using the custom function comments_like_dislike($comment_id) inside a custom comment walker.
When activating the plugin, the buttons generated by the custom function show as expected. However, below the comment text, the “non-custom” buttons are still visible. I would expect them to disappear when using the custom function?
Could you please let me know how to deal with this?
Thank you very much!
]]>I would like to report on likes and dislikes, how would I approach this?
]]>SVG icons have small size, so they are much better solution than Font Awesome.
]]>There is no need to enqueue scripts on web pages that do not contain comment form.
Also, since we are loading comment form via Ajax, scripts should not be enqueued until the comment form is displayed.
So actually plugin should enqueue scripts when comment form starts rendering.
]]>Hello, I’m reaching out to report a potential issue with the comments_like_dislike function provided by your plugin, which adds like/dislike buttons to the comments section of WordPress themes. I appreciate the functionality your plugin offers, and my objective is to display these buttons next to the reply button, which requires positioning them directly within the theme files rather than at the end of the comment text, which is the default behavior of the plugin.
# Issue Description
When attempting to directly insert the like/dislike buttons using the comments_like_dislike($comment_id) function within my theme’s comments.php
file, I encountered a fatal error. Below are the steps I took to reproduce the error:
In my-theme/comments.php:
wp_list_comments([
'callback' => 'my_comment_template',
]);
In my-theme/functions.php:
function my_comment_template($comment, $args, $depth) {
...
comments_like_dislike($comment->comment_ID);
...
}
# Encountered Error:
Fatal error: Uncaught Error: Using $this when not in object context in /var/www/html/wp-content/plugins/comments-like-dislike/inc/views/frontend/like-dislike-html.php:30
# Analysis
Upon inspecting the plugin’s source code, I noticed that the comments_like_dislike
function directly includes a PHP file (like-dislike-html.php
) that presumably requires context from the CLD_Comments_Hooks
class to function correctly. This inclusion strategy works when the plugin automatically appends like/dislike buttons but fails when like-dislike-html.php
is loaded through the theme, as the class context ($this
) is lost.
# Proposed Solution
To circumvent this issue, I devised a custom function, my_comments_like_dislike, which aims to correctly hook into the plugin’s functionality without direct file inclusion, preserving the necessary class context:
function my_comments_like_dislike($comment = null) {
if (isset($_REQUEST['comment'])) {
return '';
}
if (is_admin() && !wp_doing_ajax()) {
return '';
}
$post_id = get_the_ID();
do_action('cld_like_dislike_output', $comment, $post_id);
}
This approach appears to resolve the issue on my end. However, I’m reaching out to see if you could confirm this as a viable solution or suggest an alternative method to achieve the same result without encountering the error. Your guidance on how to properly use comments_like_dislike within theme files would be greatly appreciated.
# Additional Request
Furthermore, I would appreciate it if the plugin could be adjusted to allow the removal of the default filter that appends like/dislike buttons to the comment text. This filter is currently added as follows:
add_filter('comment_text', array($this, 'comments_like_dislike'), 200, 2);
Removing this filter from within a theme’s functions.php
file does not seem feasible without access to the class that $this
references. An option to disable this default behavior through the plugin settings or a documented method to remove the filter would greatly enhance flexibility and allow for custom placement of the like/dislike buttons.
Thank you for considering my request and issue report. Your plugin greatly enhances WordPress comment interaction, and I believe these adjustments will make it even more versatile for theme developers.
]]>Hello, it would be nice if the plugin also worked with posts too.
Thanks.
]]>Morning,
As you may be aware, both Wordfence and PatchStack are currently flagging version 1.2.1 of the plugin as having a medium security issue (see: https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/comments-like-dislike/comments-like-dislike-121-ip-spoofing).
Is there a plan to address is in an upcoming version?
Many thanks,
]]>Hi ??
Your plugin is schowing Username did not rate this post. And I’m wondering how the user can rate/vote? It also would be nice if I could translate the string as an example into german language. Maybe with a textfield in the backend like for the like or dislike hover-text.
Thanks in advance and Sorry for my bad english
Regards from Austria, Franz
]]>Hi, is there a shortcode I can use?
Thanks
]]>Hi, is there anyway you guys could add the ability to hide comments once they get so many dislikes? Maybe make it so we can enter the amount of dislikes needed before the comment is hidden. It would negate the need for a report button. Thanks!
]]>There was a request to the ActivityPub plugin that it should display likes from the Fediverse alongside likes from local users. But really it doesn’t make sense for the ActivityPub to implement its own like/dislike feature, when there are other plugins that already do this. Instead, ActivityPub allows delegating all incoming messages from the Fediverse to other relevant plugins.
I experimented with how that might look and published my results here: https://github.com/mexon/activitypub_comments_like_dislike_shim
This doesn’t require direct support for ActivityPub in the Comments Like Dislike plugin, but it does require hooks so that other plugins can add likes. So, I’d like to see those hooks implemented. Would this be possible?
Original thread here: https://social.lol/@daniel/111393357194234826
]]>whenever I try to change the plugin settings it just says “Please wait” and never loads
]]>First things first, really great plugin! Thx for your skills and time. The fact that you keep it free is a sign of your big heart.
BUT … I have one little wish ;). It would be nice if you can add the option, that enable/disable liking the own comment for registered users (I think registered users will be a bit easier than also unregistered one).
UPDATE: I think unregistered users are also necessary, otherwise you can log out and like your own one. ^^ So it’s a bit more complicated than I first thought.
Hello,
I am sure you are aware that there is a security vulnerability in your plugin. The link to the page I need help with is to a description of the plugin vulnerability, outlined by WordFence. I thought I would give you a friendly reminder about the vulnerability and also am wondering when you might have the vulnerability patched? Thanks in advance for your support.
Best Regards,
Amy Singleton
How can I sort comments, showing most liked first?
]]>The latest upgrade now shows ‘0’ votes if:
The same thing does not happen with the ‘vote down’ button. The ‘0’ that shows after the above scenario cannot be removed by toggling the ‘show 0’ setting in admin. This is new with the latest version.
]]>Errors with PHP 8.1x:
Warning Undefined array key “HTTP_CLIENT_IP”20
wp-content/plugins/comments-like-dislike/inc/classes/cld-library.php:58Plugin: comments-like-dislikeWarning
Undefined array key “HTTP_X_FORWARDED_FOR”20
wp-content/plugins/comments-like-dislike/inc/classes/cld-library.php:59Plugin: comments-like-dislike
]]>I was willing to use this plugin, but noticed it relies on jQuery. My site doesn’t load jQuery and I wouldn’t do it just for a like/dislike plugin, so: by any chance do you think about removing jQuery and use some vanilla JS in the near future?
]]>Hello,
my error.log is full with these entries. I see, that your plugin is not well maintained – but maybe you find some time to fix that.
2023/01/16 23:32:43 [error] 1081769#1081769: *9586573 FastCGI sent in stderr: "HP Warning: Undefined variable $comment_id in /home/xxxxx/html/docs/wp-content/plugins/comments-like-dislike/inc/views/frontend/like-dislike-html.php on line 84PHP message: PHP Warning: Undefined variable $comment_id in /home/xxxxx/html/docs/wp-content/plugins/comments-like-dislike/inc/views/frontend/like.php on line 5PHP message: PHP Warning: Undefined variable $comment_id in /home/xxxxx/html/docs/wp-content/plugins/comments-like-dislike/inc/views/frontend/dislike.php on line 5PHP message: PHP Warning: Undefined variable $comment_id in /home/xxxxx/html/docs/wp-content/plugins/comments-like-dislike/inc/views/frontend/like-dislike-html.php on line 27PHP message: PHP Warning: Undefined variable $comment_id in /home/xxxxx/html/docs/wp-content/plugins/comments-like-dislike/inc/views/frontend/like-dislike-html.php on line 59PHP message: PHP Warning: Undefined variable $comment_id in /home/xxxxx/html/docs/wp-content/plugins/comments-like-dislike/inc/views/frontend/like-dislike-html.php on line 60PHP message: PHP Warning: Undefined variable $comment_id in /home/xxxxx/html/docs/wp-content/plugins/comments-like-dislike/inc/views/frontend/like-dislike-html.php on line 74PHP message: PHP Warning: Undefined variable $comment_id in /home/xxxxx/html/docs/wp-content/plugins/comments-like-dislike/inc/views/frontend/like-dislike-html.php on line 84PHP message: PHP Warning: Undefined variable $comment_id in /home/xxxxx/html/docs/wp-content/plugins/comments-like-dislike/inc/views/frontend/like.php on line 5PHP message: PHP Warning: Undefined variable $comment_id in /home/xxxxx/html/docs/wp-content/plugins/comments-like-dislike/inc/views/frontend/dislike.php on line 5PHP message: PHP Warning: Undefined variable $comment_id in /home/xxxxx/html/docs/wp-content/plugins/comments-like-dislike/inc/
Hello,
What code should I put in to allow commenters to see/be notified via email when their comments have been liked?
Best,
Elaina Luna
Hi,
nice plugin. Please add support for cache plugins.
Hey, are you able to track likes and dislikes using google tag manager/analytics
Thanks in advance
]]>I’m using custom icons, but strangely the plugin keeps loading the full FontAwesome library, which is no longer needed.
Is there any way to not load FontAwesome, i.e. disable it completely?
Thank you in advance.
]]>hi ??
thx for this plugin ??
is there a way to deactivate the call for font awesome in your plugin because i load it elsewhere?
thx a lot
regards from austria
Perhaps a useful feature would be to not allow the creator of a comment to vote on their own comment. Although only one vote, this might be needed for some blogs.
The commenter’s IP address could be used to determine if they were the creator of the comment. If so, then the up/down vote is ignored.
Not a prefect solution; but overall a good enhancement.
I’d vote for it.
]]>Hi, first thx for this great plugin!
Second, if I use “comments_like_dislike($comment_id)
” inside a “foreach” loop, the “.cld-like-dislike-wrap” always jumps out of my html structure.
Short example:
<?php $recent_comments = get_comments( array(
…
) );
foreach ( $recent_comments as $comment ) : setup_postdata( $post ); ?>`
<?php
$comment_id = get_comment_ID();
echo ‘<div class=”bar”>
<div class=”like”>’. comments_like_dislike($comment_id) .'</div>
‘</div>’;
endforeach;?>`
As result the “.cld-like-dislike-wrap” dont stay inside the “.bar > .like” structure, it just jumps out of it.
How it sholud be:
<div class="bar">
<div class="like">
<div class="cld-like-dislike-wrap cld-template-1">
....
</div>
</div>
</div>
How it does:
<div class="cld-like-dislike-wrap cld-template-1">
....
</div>
<div class="bar">
<div class="like">
</div>
</div>
How can I fix this?
Thx for any help.
While using , I noticed the following errors reported:
Notice (Suppressed) Undefined index: HTTP_CLIENT_IP 38
wp-content/plugins/comments-like-dislike/inc/classes/cld-library.php:58
Plugin: comments-like-dislike
Notice (Suppressed) Undefined index: HTTP_X_FORWARDED_FOR 38
wp-content/plugins/comments-like-dislike/inc/classes/cld-library.php:59
Using WP 5.9.3 (latest), PHP version 7.4.15.
]]>It is very frustrating that if you clicked Like by mistake, there is no way to undo it.
I have only Like buttons displayed, so clicking a second time should mean Undo.
If both Like and Dislike buttons are displayed, then probably Unlike should also undo the previous Like from this user.
]]>Clicking Like updates the number of likes, and makes the button un-clickable a second time, but does not update the class list to visually indicate that, until the page is reloaded. (I use “.cld-prevent .fa-thumbs-up” to style unclickable ones differently.) This fixes it:
--- a/blog/wp-content/plugins/comments-like-dislike/js/cld-frontend.js
+++ b/blog/wp-content/plugins/comments-like-dislike/js/cld-frontend.js
@@ -50,6 +50,7 @@ jQuery(document).ready(function ($) {
if (res.success) {
var latest_count = res.latest_count;
selector.closest('.cld-common-wrap').find('.cld-count-wrap').html(latest_count);
+ selector.closest('.cld-like-dislike-wrap').find('.cld-like-dislike-trigger').addClass('cld-prevent');
if (restriction_type != 'no') {
selector.closest('.cld-like-dislike-wrap').find('.cld-like-dislike-trigger').data('already-liked', 1);
}
]]>