8

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

enter image description here


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] => test@test.com
)

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}
  • What's your exact version? I had a client contact me today with the exact same symptoms when trying to register for a new event. They're on Civi 4.6.0 with Wordpress 4.2.4. – Nicholai Aug 18 '15 at 23:59
  • I'm using Civi 4.6.4 with Wordpress 4.2.2 – user825 Aug 19 '15 at 9:27
  • Is this a free or paid event? Perhaps we can narrow it down to a payment processor (or lack thereof)? – Nicholai Aug 19 '15 at 12:46
  • Have the same issue on Drupal 7 with Civi 4.6.8 Can't seem to figure this out. This is a paid event using a price set – Yossi Sep 2 '15 at 5:39
  • 1
    I'm having the same issue (WP4.4.1, Civi4.6.10, Stripe ext 1.9.1). The extension resource url is set, and the WP Base Page using the default civicrm (which is there with the 'Do not delete this page' warning). Still getting the "Could not find valid value for ID" error. Since I'm emailing confirmation of registration, is there a way to disable the final thankyou page / redirect so that folks don't see the spurious error? I'm taking payments so it's causing more than the usual consternation. – John Bradford Jan 22 '16 at 10:23
10

This is a bit of "surprise" but essentially for 4.6 and beyond Civi event registration for Wordpress won't work unless you either 1) use a 'base page' or a 2) WP short code

Solution #1 has two steps.

  1. create a WP page with the 'civicrm' permalink
  2. set a 'base page' within CiviCRM

See attached images.

new page

base page

  • Thanks for your answer! Just checked and apparently I don't have a base page set. So will definitely try that, but at this point I already downgraded to Civi 4.4.19 (LTS), since on this version the registration works. I'm hoping to upgrade somewhere in the near future. Thanks! – user825 Sep 22 '15 at 7:53
  • 1
    We finally made time to test this answer (since we were upgrading Civi) and it works! It is worth mentioning though that my initial question was about Civi 4.6.4 and I tested this answer when I was already updated to 4.7.6. – user825 Apr 24 '16 at 19:22
0

I'm not sure of the cause, but I have a workaround. I'm guessing that you are using the direct link that Civi tells you to copy and paste from the event management page. Using that gives me the error too. However I created a WP page, embedded the event registration as a shortcode, and made it through registration and confirmation without errors.

  • But when you embed the registration form with a shortcode, you have to specify the event to show the form for, right? To give a little more insight, I created a custom shortcode that lists CiviEvents. When you click on one of these events, you'll go to the event detailpage, which is the default page from Civi that I overwrite in the custom templates folder. On this page I use the URL to the registration page that is also used in the default page from Civi. – user825 Aug 19 '15 at 9:29
3

I was having a similar problem. I noticed the base url for WordPress was not set.

If you haven't set that, try setting that in Administer > CMS Database Integration and let us know if that fixed your issue.

Make sure the event is not the home page, that seems to cause problems with the base url.

  • It's called a "base page" actually. And the second step of this configuration is to actually create a WP page with this URL. For instance if your base page is "civi" your WP page must have the permalink of "civi" as well. See my post below for screenshots – CiviTeacher Sep 21 '15 at 21:01
  • I misunderstood your answer, Sanjay Jain. I noticed it was set to the base URL of the website, so I thought that was okay. CiviTeacher cleared this up now and will try this solution! Thanks for your help! – user825 Sep 22 '15 at 7:59
1

On 4.7.9 + WP 4.5.3 I had this problem.

I have a paid event, with PayPal as payment processor, but also the Pay Later option is enabled.

Registrations proceed fine when paid with PayPal. I only get this error when a user ticks the Pay Later option.

I tried using a WP shortcode as CiviTeacher mentioned but that did not work. I had to set a Base Page - i.e., Administer | System Settings | CMS Database Integration could not be blank.

It doesn't have to be civicrm, it can be anything you want. You can use http://www.domain.org/event or something similar.

Then you have to create a Page in WordPress with this URL as the permalink. I then put the event shortcode on this page and it works great!

In my case I then set up an intro page at http://www.domain.org/ with a "Registration" link to http://www.domain.org/event.

1

If you upgrade from CiviCRM < 4.6, and have a WP frontend with links to Civicrm pages (e.g. an event calendar) that are full URLs, you'll need to edit those links: from 'http://example.com/?page=Civicrm...' to 'http://example.com/civicrm/?page=Civicrm...' to get the basepage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.