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!
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
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!