This is my first question on a stackexchange-like website, so bare with if I fail to mention something important about my question.
The situation
At the moment, I’m working on my very first CiviCRM-system in combination with Wordpress. My client currently uses CiviCRM in combination with Drupal, so I migrated the CiviCRM-database. The system mainly focusses on CiviEvents. The below is tested while not logged in as a Wordpress-user.
The problem
The problem I’m facing is that when I want to subscribe on a CiviEvent with the standard register-form provided by Civi, I end up getting redirected to this URL and this error is presented:
Redirected to:
http://localhost/DNN/?page=CiviCRM&q=civicrm%2Fevent%2Fregister&_qf_ThankYou_display=true&qfKey=74c1a421f35974b95728fb7b661a9d79_1904
Presented error: Could not find valid value for id
The registration does come through though. So apparently, saving the registration is going well.
When I debugged this issue I found that this error is thrown when the class CRM_Event_StateMachine_Registration is instantiated and the following is executed:
$id = CRM_Utils_Request::retrieve('id', 'Positive', $controller, TRUE);
(file: CRM/Event/StateMachine/Registration.php)
The method retrieve tries to extract the value for id from either $_GET, $_POST or $_REQUEST. In this case, he tries to extract it from $_REQUEST. The contents of $_REQUEST is:
Array
(
[page] => CiviCRM
[q] => civicrm/event/register
[page_id] => 6
[noheader] => 1
[qfKey] => ecb991dac9477d393014910b1472fb2b_9259
[entryURL] => http://localhost/DNN/?page=CiviCRM&q=civicrm/event/register&page_id=6&page=CiviCRM&id=506&reset=1
[scriptFee] =>
[scriptArray] =>
[_qf_default] => Register:upload
[MAX_FILE_SIZE] => 33554432
[phone-Primary-2] => 0612345678
[current_employer] => Test-employer
[first_name] => Test-firstname
[last_name] => Test-lastname
[street_address-2] => Test-street-address
[postal_code-2] => Test-postal-code
[city-2] => Test-city
[participant_source] =>
[email-Primary] => [email protected]
)
As you can see, id is indeed missing. So I think the real question is: why isn’t Civi sending the id in this request? It is a standard, by Civi provided functionality after all.
Does anyone have any idea why I’m getting this message?
For completeness, this the backtrace from the point this error is thrown:
0 - Request.php - Line: 95 - dnn_backtrace () - /DNN/wp-content/plugins/civicrm/civicrm/CRM/Utils/Request.php
1 - Registration.php - Line: 52 - retrieve () - /DNN/wp-content/plugins/civicrm/civicrm/CRM/Event/StateMachine/Registration.php
2 - Registration.php - Line: 47 - __construct () - /DNN/wp-content/plugins/civicrm/civicrm/CRM/Event/Controller/Registration.php
3 - Invoke.php - Line: 307 - __construct () - /DNN/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php
4 - Invoke.php - Line: 86 - runItem () - /DNN/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php
5 - Invoke.php - Line: 54 - _invoke () - /DNN/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php
6 - civicrm.php - Line: 1189 - invoke () - /DNN/wp-content/plugins/civicrm/civicrm.php
7 - civicrm.basepage.php - Line: 134 - invoke () - /DNN/wp-content/plugins/civicrm/includes/civicrm.basepage.php
8 - - Line: - basepage_handler () -
9 - plugin.php - Line: 571 - call_user_func_array () - /DNN/wp-includes/plugin.php
10 - class-wp.php - Line: 622 - do_action_ref_array () - /DNN/wp-includes/class-wp.php
11 - functions.php - Line: 877 - main () - /DNN/wp-includes/functions.php
12 - wp-blog-header.php - Line: 14 - wp () - /DNN/wp-blog-header.php
13 - index.php - Line: 19 - require () - /DNN/index.php
EDIT
I forgot all about the error-logging Civi does. This is the error that is logged after registration.
Aug 18 14:31:54 [info] $Fatal Error Details = Array
(
[message] => Could not find valid value for id
[code] =>
)
Aug 18 14:31:54 [info] $backTrace = #0 /DNN/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(363): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /DNN/wp-content/plugins/civicrm/civicrm/CRM/Utils/Request.php(96): CRM_Core_Error::fatal("Could not find valid value for id")
#2 /DNN/wp-content/plugins/civicrm/civicrm/CRM/Event/StateMachine/Registration.php(52): CRM_Utils_Request::retrieve("id", "Positive", Object(CRM_Event_Controller_Registration), TRUE)
#3 /DNN/wp-content/plugins/civicrm/civicrm/CRM/Event/Controller/Registration.php(47): CRM_Event_StateMachine_Registration->__construct(Object(CRM_Event_Controller_Registration), TRUE)
#4 /DNN/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(307): CRM_Event_Controller_Registration->__construct("Event Registration", TRUE, "null", NULL, "false")
#5 /DNN/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:15))
#6 /DNN/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
#7 /DNN/wp-content/plugins/civicrm/civicrm.php(1189): CRM_Core_Invoke::invoke((Array:3))
#8 /DNN/wp-content/plugins/civicrm/includes/civicrm.basepage.php(134): CiviCRM_For_WordPress->invoke()
#9 [internal function](): CiviCRM_For_WordPress_Basepage->basepage_handler(Object(WP))
#10 /DNN/wp-includes/plugin.php(571): call_user_func_array((Array:2), (Array:1))
#11 /DNN/wp-includes/class-wp.php(622): do_action_ref_array("wp", (Array:1))
#12 /DNN/wp-includes/functions.php(877): WP->main("")
#13 /DNN/wp-blog-header.php(14): wp()
#14 /DNN/index.php(19): require("/DNN/wp-blog-header.php")
#15 {main}