{"action":"closed","issue":{"url":"https://api.github.com/repos/eventespresso/event-espresso-core/issues/91","labels_url":"https://api.github.com/repos/eventespresso/event-espresso-core/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/eventespresso/event-espresso-core/issues/91/comments","events_url":"https://api.github.com/repos/eventespresso/event-espresso-core/issues/91/events","html_url":"https://github.com/eventespresso/event-espresso-core/issues/91","id":91374270,"number":91,"title":"Session/Cart cleared before getting to event registration page","user":{"login":"richardtape","id":116946,"avatar_url":"https://avatars.githubusercontent.com/u/116946?v=3","gravatar_id":"","url":"https://api.github.com/users/richardtape","html_url":"https://github.com/richardtape","followers_url":"https://api.github.com/users/richardtape/followers","following_url":"https://api.github.com/users/richardtape/following{/other_user}","gists_url":"https://api.github.com/users/richardtape/gists{/gist_id}","starred_url":"https://api.github.com/users/richardtape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardtape/subscriptions","organizations_url":"https://api.github.com/users/richardtape/orgs","repos_url":"https://api.github.com/users/richardtape/repos","events_url":"https://api.github.com/users/richardtape/events{/privacy}","received_events_url":"https://api.github.com/users/richardtape/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2015-06-26T22:05:40Z","updated_at":"2015-07-06T17:37:27Z","closed_at":"2015-07-06T17:37:26Z","body":"Hey folks, this is a bit of a strange one, and I'm fairly sure it's platform specific, but I was hoping you may be able to help shed some light.\r\n\r\nWe're using the Single Page Checkout - all events are free. So the process is a user sees an event, clicks to view details, then clicks 'Register Now' as there's only ever one ticket type, they're always 0-priced. They're taken to the 'event-registration' page which is where they fill in their details.\r\n\r\nLocally, this works great. However, when we put it on our staging environment the process breaks down. When a user clicks 'Register Now' they are taken to the event registration page, but they see a message \r\n\r\n>Nothing in your Event Queue.\r\n\r\nI've looked through the EE source and found that's what happens when the cart is empty in `modules/single_page_checkout/templates/registration_page_wrapper.template.php` line 19. `$empty_cart` is a template_arg passed in from `_display_spco_reg_form()` and it's because `$this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params )` returns an empty array.\r\n\r\nI've been trying to follow the stack to see exactly where things are going awry and added an output on the `AHEE_log` action. I *think* it's something to do with how the session is passed around. If I do\r\n\r\n```\r\nadd_action( 'AHEE_log', 'eedebug_test_log_output', 10, 3 );\r\nfunction eedebug_test_log_output( $file, $function, $string ) {\r\n\r\n\tif ( $function !== '_save_session_to_db' ) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tfile_put_contents( WP_CONTENT_DIR . '/debug.log', print_r( array( $file, $function, $string, $_POST, $_GET, $_REQUEST  ), true ), FILE_APPEND );\r\n\r\n}\r\n```\r\n\r\nThen from that I can see that from when the person clicks the 'Register Now' button, the `_save_session_to_db` method is called 3 separate times. The first two are still on the single events page itself, and contain the $_POST vars that you would imagine from the form i.e.\r\n\r\n```\r\nArray\r\n        (\r\n            [process_ticket_selections_nonce] => f6fc2b3013\r\n            [_wp_http_referer] => /events/edx-studio-3/\r\n            [tkt-slctr-qty-1215] => 1-1\r\n            [tkt-slctr-ticket-id-1215] => Array\r\n                (\r\n                    [0] => 542\r\n                )\r\n\r\n            [noheader] => true\r\n            [tkt-slctr-return-url-1215] => /events/edx-studio-3/\r\n            [tkt-slctr-rows-1215] => 1\r\n            [tkt-slctr-max-atndz-1215] => 1\r\n            [tkt-slctr-event-id] => 1215\r\n        )\r\n```\r\n\r\nThe third time the method is run, we're on the event-registration page and the `$_POST`, `$_GET` and `$_REQUEST` globals are all empty.\r\n\r\nIf I take a look inside the `_espresso_session()` method I can see that you're looking for an already open session and if there is one, then you're looking for a transient based on the session ID. The issue here is we use a custom authentication system called CAS which is session based. So while there *is* a session, there's no transient with that name. So the conditional at https://github.com/eventespresso/event-espresso-core/blob/master/core/EE_Session.core.php#L410 is going to fail meaning we're going to return false there on line 434.\r\n\r\nSo I'm a bit stuck as to how that would work in our case. Any suggestions?\r\n\r\nHappy...Friday...? :)"}}