CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Event Registration: Could not find a valid session key
Pages: [1]

Author Topic: Event Registration: Could not find a valid session key  (Read 822 times)

pbarmak

  • I post occasionally
  • **
  • Posts: 111
  • Karma: 3
  • CiviCRM version: 3.3.5
  • CMS version: Pressflow 6.19
  • MySQL version: 5.1
  • PHP version: 5.2.10
Event Registration: Could not find a valid session key
September 22, 2014, 03:21:10 pm
We're in process of upgrading to 4.2 (from 3.4).  Our users go to our Event Registration pages through another form, the form looks up their current information and POSTs it to the Event Registration page with hidden fields, which then populates the Event Registration page fields.  It has been working for years in the older version, but as of 4.2, I'm getting the following error and I'm not sure what is causing it.  Below is the backtrace, but I don't see anything pointing to any of our custom code or anything of that sort.  I've checked the base url, it's all fine.  I would love some help.

Code: [Select]
Sorry. An error has occurred.

We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site adminstrator for assistance.

Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org or a domain alias like http://myotherexample.org.

Error type: Could not find a valid session key.

Code: [Select]
backTrace

#0 /var/www/civicrm/sites/all/modules/civicrm/CRM/Core/Error.php(311): CRM_Core_Error::backtrace()
#1 /var/www/civicrm/sites/all/modules/civicrm/CRM/Core/Controller.php(272): CRM_Core_Error::fatal("We can't load the requested web page. This page requires cookies to be enable...")
#2 /var/www/civicrm/sites/all/modules/civicrm/CRM/Core/Controller.php(176): CRM_Core_Controller->key("CRM_Event_Controller_Registration", TRUE, FALSE)
#3 /var/www/civicrm/sites/all/modules/civicrm/CRM/Event/Controller/Registration.php(41): CRM_Core_Controller->__construct("Event Registration", "null")
#4 /var/www/civicrm/sites/all/modules/civicrm/CRM/Core/Invoke.php(215) : eval()'d code(1): CRM_Event_Controller_Registration->__construct("Event Registration", TRUE, "null", NULL, "false")
#5 /var/www/civicrm/sites/all/modules/civicrm/CRM/Core/Invoke.php(215): eval()
#6 /var/www/civicrm/sites/all/modules/civicrm/CRM/Core/Invoke.php(51): CRM_Core_Invoke::_invoke((Array:3))
#7 /var/www/civicrm/sites/all/modules/civicrm/drupal/civicrm.module(382): CRM_Core_Invoke::invoke((Array:3))
#8 [internal function](): civicrm_invoke("event", "register")
#9 /var/www/civicrm/includes/menu.inc(350): call_user_func_array("civicrm_invoke", (Array:2))
#10 /var/www/civicrm/index.php(17): menu_execute_active_handler()
#11 {main}
« Last Edit: September 22, 2014, 03:37:07 pm by pbarmak »

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Event Registration: Could not find a valid session key
September 23, 2014, 04:25:08 am
Hi,

you might want to avoid that extra step and link directly to the event registration with a checksum token, so it automatically fetch the right data without extra work on your side. Or if you have different sources, write it as an extension and pre-fill the "real civi" form directly.

I'm not sure anymore if/what has changed between 3.4 and 4.2, but civi has a several systems to avoid that bots spam and fill automatically forms. Unfortunately, what you are going is dangerously close to how the bots proceed, so might be that you are tripping on one of the safety mesures.

If the issue is being able to customise the form, checkout webform_civicrm, that might come as a stable replacement option for what you're trying to do

-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

pbarmak

  • I post occasionally
  • **
  • Posts: 111
  • Karma: 3
  • CiviCRM version: 3.3.5
  • CMS version: Pressflow 6.19
  • MySQL version: 5.1
  • PHP version: 5.2.10
Re: Event Registration: Could not find a valid session key
September 23, 2014, 05:29:41 am
Quote from: xavier on September 23, 2014, 04:25:08 am
you might want to avoid that extra step and link directly to the event registration with a checksum token, so it automatically fetch the right data without extra work on your side. Or if you have different sources, write it as an extension and pre-fill the "real civi" form directly.

xavier, first, thank you for replying, I always appreciate the help I get here.  It sounds like I've been going about this the wrong way, but that wrong way has worked for a while.  Let me step back, if you don't mind, and ask what the correct way to do this would be.  Here is our scenario:

We send short term teams of people to different locations (to serve in other countries).  People sign up for these teams through an Event Registration (each team is an Event, nothing special).  All who sign up are anonymous users, they have no log in information.

Now, some people will go on 2 or more trips (once a year or multiple times per year).  For them, based on their previous registration, we want to pre-populate several fields on the Event Registration Form, including things like their passport dates, date of birth, and a few custom fields we've created that are related to the Contact and to the latest Participant record for that Contact.

To solve this, what we do today is have an extra link on our Event Registration form called "Repeat Team Member", which takes them to a custom php page, which is just a form that takes in the first and last name and email address.  From that we do a database select for their information, create a bunch of hidden html form fields from the result, and submit that form back to the Event Registration page with all the fields in the POST.  Obviously, this method is what must be non-standard and causing the error in 4.2.

What would be the more standard way to do this?  I looked at checksum tokens, and that seems like it could be useful, but only for Contact related fields, it does not seem to pull from the latest Participant record.  Could I modify checksum tokens to fit my needs?  Also, I tried an Event Registration link with those tokens in the URL per the documentation, and it did nothing (didn't populate fields) - is there some set up I need to do first?  Or does it only work with certain profiles?

If an extension is the way to go, would you mind providing some basic steps on how it would work?  I'm not clear on what you mean by pre-filling the "real civi" form directly - how is that done through an extension?

I would really love the help here, this happens to be an important feature for people who go on multiple teams.  Thanks!
« Last Edit: September 23, 2014, 05:34:57 am by pbarmak »

sonicthoughts

  • Ask me questions
  • ****
  • Posts: 498
  • Karma: 10
Re: Event Registration: Could not find a valid session key
September 27, 2014, 06:22:59 pm
If you are using Drupal I would definitely use civicrm webforms - sounds like it was made for just that use case. 

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Event Registration: Could not find a valid session key

This forum was archived on 2017-11-26.