Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Help With Like Plugin

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #33216
    realph
    Participant

    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.

    #82040
    ddliu
    Member

    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!

    #82051
    realph
    Participant

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.