Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bobgeorge

    (@bobgeorge)

    Right, upon further investigation, the chat box not showing was a strange “half-logged-in” thing with WordPress.

    Because I also had the dashboard open in another tab, WordPress must have created one of its cookies there, in the other tab, and so my code cleared out all cookies – but WordPress put one, but not all, of its login cookies back – and this state of being “half-logged-in” to WordPress was causing the issue for the plugin.

    I’ve revised my code to first “wp_logout” if the user is logged into WordPress first, then it clears out all the cookies. Being properly logged out before clearing cookies seems to fix the bug.

    And I apologise for the accusations of broken behaviour to the plugin authors. It was WordPress itself that was the root cause of the issue, not the plugin. Which, once I’d fixed the “half-logged-in” issue seems to be functioning correctly as expected. The plugin works – but it naturally depends on WordPress to work, and it was WordPress that had the broken behaviour.

    The lesson appears to be “don’t leave admin tabs open while testing” – but, really, WordPress itself should not be really doing that to allow any such “half-logged-in” behaviour in the first place.

    Anyway, not an issue with the plugin itself.

    And my “force cookies to be removed” alternative strategy will, I guess, have to do for the time being – it’s clunky and needs a user to click a button to make it happen, but it will do what’s needed – unless someone here can let me know of a more graceful way to make the Live Chat cookies expire immediately, so that it leaves no trace of the use of the chat box on the client’s machine.

    • This reply was modified 6 years, 1 month ago by bobgeorge. Reason: typo
    Thread Starter bobgeorge

    (@bobgeorge)

    Okay, I attempted an alternative strategy to overcome this problem.

    Namely, I wrote some PHP code that clears out all cookies and then redirects to another page – so the user clicks on a “clear cookies” button, the PHP code is run to set all the cookies to null and an expiry date in the past to clear them out (e.g. “setcookie”) and then a redirect sends these headers to make it happen.

    While this code does what’s expected – the cookies are all cleared – this, in fact, breaks the Live Chat plugin.

    The chat box doesn’t appear anymore and I can’t get it back. Saving the settings or turning the chat off and on again, doesn’t make the chat box return to normal once more.

    This seems like broken behaviour to me, as a plugin shouldn’t be relying on cookies to exist to function. While, yes, I forcefully deleted the cookies with PHP code, it’s entirely possible that a user might have also manually cleared out their cookies too – I was only automating the process for the benefit of the user with a “clear cookies” button for them to click. Users are perfectly capable and allowed to manually delete cookies themselves, and they’re also permitted to reject them too, so a plugin should not rely on their presence to even function.

    That seems like standards-breaking broken behaviour. That’s not how cookies should work.

    Whilst information is lost in deleting cookies, a site / plugin should cope with their absence (perhaps, yes, recreating some new “first use” cookies again). It shouldn’t just fall over and functionality stops working completely.

    So I still await a solution to this – and you can add my discovery that removed cookies actually stops the chat box from even appearing as a “bug report” too.

    • This reply was modified 6 years, 1 month ago by bobgeorge.
Viewing 2 replies - 1 through 2 (of 2 total)