• Resolved zeeranger

    (@zeeranger)


    Hi,

    I’m using this custom script in my child theme to enable likes on single posts.

    It presents some issues with LSC plugin activated. If a user clicks on a post (with say 5 likes) and clicks on the like button (new like count = 6), then goes back to home page (or any other page) and revisits the older liked page, the like counter shows the older count (i.e 5 instead of 6) and the “liked” status disappears, thereby allowing the user to hit like again.

    The same thing also happens if user clicks like then reloads the page.

    But, none of this happens with LSC deactivated.

    How can I make this script work smoothly with LSC?

    • This topic was modified 5 months, 2 weeks ago by zeeranger.
    • This topic was modified 5 months, 2 weeks ago by zeeranger.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support qtwrk

    (@qtwrk)

    please provide the report number

    you can get it in toolbox -> report -> click “send to LiteSpeee”

    Thread Starter zeeranger

    (@zeeranger)

    Sure. It is QEXPILFI

    Plugin Support qtwrk

    (@qtwrk)

    I see, because the display function is not using admin-ajax.php , but only “add like” is using admin-ajax.php

    the point to use cache plugin is to avoid execute PHP , so this is expected behavior

    you need to use post count plugin with ajax displaying as well, to make it compatible with cache plugin.

    Thread Starter zeeranger

    (@zeeranger)

    Oh I see. Thanks! Although I understand exactly what you mean, I do not know how to fix it myself.

    Is there a possibility to add an exception somewhere in LSC settings to not cache the plugin or its data?

    I know that this will not be an ideal solution but it will at least let me get to a temp. working solution.

    Plugin Support qtwrk

    (@qtwrk)

      update_post_meta( $post_id, 'like_count', $like_count );

    change this line to

      update_post_meta( $post_id, 'like_count', $like_count );
    if (defined('LSCWP_V')){
    do_action( 'litespeed_purge_post', $post_id );
    }

    this should purge the page when someone clicked like button , this should make it display the latest result

    Thread Starter zeeranger

    (@zeeranger)

    Thanks a ton for the workaround!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.