• Resolved milesbrennan

    (@milesbrennan)


    Hi Team,

    I noticed my menus which were set with “Show to Logged In / Out Users” weren’t being respected… i.e. when I was logged out, I would follow the “Login” link, then log in successfully via the login page, however the menu would still show the “Login” link in the page.

    If I browsed to other pages, it would occasionally change, so the Login menu item disappeared, and the “Logout” menu item was now visible. After disabling my plugins, I noticed the everything worked when I disabled “WP Fastest Plugin”, and after finding the exact same issue reported about 12 months ago on this thread, I realised it was a user session cookie issue.

    https://www.ads-software.com/support/topic/member-logout-menu-still-displays-even-when-logged-out/

    I can see that WP Fastest Cache plugin supports regex filtering, and I added an exclusion for “wp_logged_in_*” as recommended in other thread, however this did not resolve the issue.

    When I check my cookie on the application, I see “wordpress_logged_in_1234567….” type cookie names, so I added an exclusion for this instead. It seems to be working fine.

    I thought I’d still ask the question if the cookie name has changed since last thread, and this is the correct workaround to our issue.

    Regards.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support mark l chaves

    (@mlchaves)

    Thanks for reaching out. That’s a great question.

    I thought I’d still ask the question if the cookie name has changed since last thread, and his is the correct workaround to our issue.

    As Daniel mentioned in the thread your referenced, that cookie name is controlled by WordPress.

    Learn more here https://developer.www.ads-software.com/reference/hooks/set_logged_in_cookie/

    If they ever decide to change that cookie name, it would break a lot of websites. So, it’s probably safe to say that name hasn’t changed nor will it change any time soon.

    Correct, you should use a cache that respects the logged-in cookie. If you can set your cache to bypass cached files when the logged-in cookie is set, you should be good to go as you’re noticing now.

    We hope that helps. Let us know if you need anything else.

    Have a great day ??

    Mark

    Thread Starter milesbrennan

    (@milesbrennan)

    Looks like the cookie value was change in WP 2.6.0

    wp-includes/default-constants.php

    /**
     * @since 2.6.0
     */
    if ( ! defined( 'LOGGED_IN_COOKIE' ) ) {
    	define( 'LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH );
    }

    Glad I figured that out, wp_logged_in_ was a fail for me, now I see why.

    Learn more here
    https://wpseek.com/constant/logged_in_cookie/#source

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Menus Not Respecting Logged In/Out User Session’ is closed to new replies.