• Resolved John Webber

    (@bilion)


    Hi, thank you for this amazing plugin!

    We are made to choose to have pages cached as a guest visitor, in order to prevent random people entering the backend.

    Let’s compromise, and have pages cached for both logged-in and logged-out users.

    Is it possible to always cache pages as a logged out visitor, but have a small script that will check if you should be logged in, and use WP Fetch API to get the admin bar?

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @bilion

    Thank you for reaching out and I am happy to assist you with this.
    Just to confirm, do you wish to have Page Cache enabled for Logged in users with specific user roles and the logged-out users, and not for ALL logged-in users? is that correct? Also, the top admin bar should be visible to the logged-in user (guest visitor) ?

    Thanks!

    Thread Starter John Webber

    (@bilion)

    Pozdrav Marko

    I wish to have Page Cache enabled for both logged-in and logged-out users

    Currently, if I cache logged-in users, and if the first one to view the page is an admin, the website will remain unlocked on that page, with the admin bar visible, giving access to the backend to anyone

    To cache pages for admins, I could turn off the adminbar for every admin, but the clients would find that very inconvenient. Also, the site would be easily hacked, since it is “unlocked”, even if the admin bar is not showing

    What I’m proposing, is to cache every page as if it is viewed by a random visitor, and then check for the admin’s cookie. And if found, use Fetch API to get the adminbar and unlock the backend

    Srdačno
    Jovan

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @bilion

    Thank you for your feedback and clarification.
    This is why it’s never recommended to cache pages for logged-in users. And the problem with the use case you are proposing is that the admin bar is a part of the page, and therefore is in the HTML that is cached. So the only workaround, if you want to achieve this, is to make a lot of changes in the wp and load the admin bar with Ajax, therefore bypassing the cache.

    So yes, your proposal could work in some way, however, it’s out of W3 Total Cache scope.

    I hope this helps and answers your question.

    Ako mogu jos nekako da pomognem, tu sam!

    Pozdrav!

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

The topic ‘Fetch The Adminbar For Admins’ is closed to new replies.