• Resolved therealgilles

    (@chamois_blanc)


    Hello,

    My provider has a buggy varnish config setup that I am trying to work around. To do so, I would like control when a session starts and stops. More precisely, I would like to be able to control when the _wp_session cookie gets created and I would like it to get removed when necessary.

    The scenario would be as follows:
    1) Visitor loads site. Session is not created yet, cookie is not set.
    2) Visitor adds product to store cart. Session starts, cookie is set.
    3) Cart gets emptied (visited removes all products from cart or after checkout). Session stops, cookie is unset.

    Is there a clean way to do this without hacking the plugin too much? is it a bad idea to try to do this? (versus get my provider to fix their varnish cache support)

    I am using the plugin to create a cart session timer and it works great. A timer starts counting down once something added to the cart. Once the timer expires, the cart is automatically emptied. A la ticketmaster.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Eric Mann

    (@ericmann)

    The plugin no longer uses a _wp_session cookie and, as of v3.0, uses native PHP sessions (and the standard PHPSESSID cookie). Sessions start by default on the plugins_loaded event if not started some other way.

    Thinking out loud … you <i>might</i> be able to unhook that particular event, then wire up session_start() where you need it explicitly. As for destroying a session, the default session_destroy() will purge the data and kill the cookie.

    Thread Starter therealgilles

    (@chamois_blanc)

    Hi Eric,

    Thank you for the update. Not having the cookie should alone fix my problem, so that’s great!

    Session destroy won’t destroy the cookie sitting in the user’s browser. For that either the user has to clear cookies or your Php has to send the cookie again with an expiry date in the past.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Control when session starts/stops’ is closed to new replies.