• biglifesolutions

    (@biglifesolutions)


    Hi

    Great plugin, love it and use it to check materials and notes that I allocate to coaching clients are being allocated to the right clients so I don’t breach confidentiality. I’m encountering a strange issue that has only just started happening.

    When I view as a user it displays correctly with their name. But when I go back to Admin, instead of showing my name it has started showing the name if the user I was previously viewing hat page as. Alarmingly, this is also happening for any user who tried to login to their dashboard – it says “Welcome to your dashboard [Name of User I just Viewed a Page as]. If I totally clear the cache it rectified, but then immediately does it again when I view as another user.

    I can cope with needing to clear the cache but it is obviously not a good look if my clients log in and are greeted with someone else’s name.

    Any ideas what may be going on?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @biglifesolutions

    WordPress core doesn’t include cache like you mention so I assume you have a plugin active which handles caching. Unfortunately, I do not have custom compatibility for every cache plugin out there, as this quickly becomes unmaintainable, so I think a custom solution would be best here.

    There is a hook available that will run when a view is active: “vaa_view_admin_as_do_view”. Depending on your cache plugin you could disable cache when this action runs.

    (Edit) Alternatively, you could just disable cache for logged-in users.

    If you give me more info on your installation then I could help you further 🙂

    Cheers, Jory

    Thread Starter biglifesolutions

    (@biglifesolutions)

    Amazing, thanks Jory. You gave me an idea and I am simply excluding the specific URLs that seem to be affected, and that appears to be working.

    I’d be interested in a more global solution – I use Lightspeed cache and couldn’t see any way to get it to disable caching when the hook ran. As I am not that technical I may be missing something obvious, but if you know off the top of your head hat I need to do that would be brilliant.

    Thanks for your help!

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @biglifesolutions

    Perfect, good to hear!

    And luckily Litespeed already includes several actions to clear cache easily. I believe the following code should work:

    <?php
    add_action('vaa_view_admin_as_do_view', function() {
    if ( ! defined( 'DONOTCACHEPAGE' ) ) {
    define( 'DONOTCACHEPAGE', true );
    }
    });

    Important! This code should be added as a MU plugin, inside “wp-content/mu-plugins/“. You can name the file as you’d like as long as its a .php file, for example “vaa-litespeed.php“.

    Let me know, cheers! Jory

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

You must be logged in to reply to this topic.