Grow your CSS skills. Land your dream job.

Help With Like Plugin

  • # June 21, 2011 at 7:16 pm

    Hey guys,

    I found this awesome “like” plugin the other day (http://lifeasrose.ca/2011/03/wordpress-plugin-i-like-this/) but I seem to be having a problem with it.

    For some reason, it lets the user “like” to their hearts content and doesn’t seem to show the “done” class on refresh to show the user that they’ve already “liked” the post. It seems to work fine on the author’s test blog, so I can’t work out why it’s not working for me.

    I contacted the author and she said she couldn’t understand why it works for some and not others and recommended that I check to see if the AJAX postback is being seen by the PHP script. Could anyone on here possibly help me with that? I’d really appreciate it.

    Thanks in advance.

    # June 22, 2011 at 3:19 am

    There are 2 bugs I’ve found causing this problem, see my comment in the plugin page.

    You have to modify the likethis.php file to fix it.

    1. Replace all $_COOKIE[“like_” + $post_id] with $_COOKIE[“like_” . $post_id].

    Yes, use “.” but not “+” to concat string. It’s PHP, not JS.

    2. There is a line:


    setcookie("like_" . $post_id, $post_id,time()*2);

    The expiration time is wrong, you can change it to time()+1800, which means half an hour.

    It works for me, I was testing it with wordpress 3.1.3 and PHP version 5.3.5.

    Hope it works for you, good luck!

    # June 22, 2011 at 8:56 am

    Thanks a bunch!!! That worked perfectly. I’ll notify the author!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".