• Resolved the_lar

    (@the_lar)


    Hi all,

    I’ve built an awards platform for a client in WordPress which allows users to register and vote on nominations. I use Litespeed plugin with Redis but parts of the voting functionality on the archive pages and the single nomination pages isn’t reflecting the fact that the user has placed a vote. I’ve confirmed that this is because of caching by disabling Litespeed which makes it function correctly. The issue is nothing to do with Object caching, disabling Redis only has no effect.

    I’ve been advised that I should look into ‘Do not cache’ blocks for the relevant bits of my templates or to try ESI, however I’ve tried googling for examples and bits of code I might be able to use but can’t really find anything suitable.

    Can anyone give me a few pointers how to go about achieving this?

    Many thanks
    Kevin

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Hai Zheng?

    (@hailite)

    How did you reflect that the user has voted?

    You can give the page a purge by our API when user is placing a vote. However, if the UI after voted is different than the one before vote but they are same URL, you may need to give the voted users either no cache or a separate cookie (which we called vary) to make it a separate cache.

    Thread Starter the_lar

    (@the_lar)

    Hi there,

    OK, just to explain it a little bit more… users have to be logged in to vote, they can register for this after which they get an activation email with a link, once activated they can log in. There are a couple different voting phases, one for staff and one for the general public. General public can register to vote any time, but can only vote during the voting phase but that doesn’t start till later this week.

    The page url in question is something like https://mydomain.com/community-project/ – this is an archive page which lists out all the community-project post types and at the top of this page is a block which informs the user which project they have voted for, and at what time etc, or if no vote has been cast. Each community project listed has a vote button (which only displays if the user has not voted already) so that users can choose to vote for the project they want to win. Users are only allowed one vote, so once the vote has been cast, the page refreshes and the block at the top now displays the vote information and inserts a button to reset their vote. The vote buttons are also removed from each item in the list.

    I use a bootstrap modal window for the vote dialogue and some ajax calls which set the relevant meta data on the user and the post. When the vote is cast successfully, the page just refreshes and displays the new voting status according to whether the vote was cast or reset.

    The site is built using Sage 9 starter theme and uses Theme My Login plugin for user registration/login etc.

    Hope that explains the scenario a bit more, I do have a staging version of the site which I would be more than happy to provide access to if you think it would help?

    Much appreciated
    Kevin

    • This reply was modified 6 years, 6 months ago by the_lar.
    • This reply was modified 6 years, 6 months ago by the_lar.
    Plugin Support Hai Zheng?

    (@hailite)

    Did you try to give the voted users a vary?

    Plugin Support LiteSpeed Lisa

    (@lclarke)

    Hi @the_lar,

    I’m going to mark this topic “Resolved,” due to lack of activity.

    You never stated whether you tried to use a vary cookie. Just in case you need to know more about that, you can check out the cache vary documentation and our API.

    If you still need help, we’ll be happy to reopen the topic.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Do not cache blocks or ESI blocks in template – how?’ is closed to new replies.