Answers.Body: <p>I am fairly confident that your issue is that the WordPress <code>redirect_canonical</code> function is rewriting your unescaped CiviCRM URLs and redirecting to properly escaped URLs during the registration process. This would cause your session to be cleared during the redirect.</p>
  
  <p>I recently fixed the as much of the code as I could find where CiviCRM generates URLs and updated it to produce valid URLs that wouldn't be caught by <code>redirect_canonical</code>. The latest CiviCRM has the fixes (so upgrading is as always recommended) but here are the relevant PRs in case you want to back-port them to your version:</p>
  
  <ul>
  <li><a href="https://github.com/civicrm/civicrm-core/pull/13043" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-core/pull/13043</a></li>
  <li><a href="https://github.com/civicrm/civicrm-core/pull/12969" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-core/pull/12969</a></li>
  <li><a href="https://github.com/civicrm/civicrm-core/pull/12968" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-core/pull/12968</a></li>
  </ul>
  
  <p>As the question is also Paypal-related, you should also be aware of:</p>
  
  <ul>
  <li><a href="https://civicrm.stackexchange.com/a/27958/520">https://civicrm.stackexchange.com/a/27958/520</a></li>
  </ul>
  
  <p>I haven't verified that jgillmanjr's fix works, but the logic looks right to me.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-28T00:46:53.443Z
Answers.Text: i'm scratching my head on this for a couple of weeks now trying to get an installation updated from 5.28 .. where it worked fine. also with 5.33 which i tested for verification. but with 5.44 i can't get no 'thank you' page displayed after registration.
  
  URLs look fine - the key after _qf_Confirm_display=true&qfKey= is identical with the one on _qf_ThankYou_display=true&qfKey=
  
  we are *not* using any payment provider, civicrm 5.44, wordpress 5.8.2
Answers.UserDisplayName: markusk
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-11T16:32:43.570Z
Answers.LastActivityDate: 2019-01-11T16:32:43.570Z
Answers.UserDisplayName: Christian Wach
Body: <p>Whenever someone registers for an event, this error displays instead of the thank you page:
  <a href="https://i.sstatic.net/u2Xlj.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/u2Xlj.jpg" alt="enter image description here"></a></p>
  
  <p>I'm using Wordpress and I have a civicrm page, and I have the Wordpress base page set to the civicrm page on the CMS Database Integration page in civi. The url for the error page displayed is:
  ?page=CiviCRM&amp;q=civicrm%2Fevent%2Fregister&amp;_qf_ThankYou_display=true&amp;qfKey=</p>
  
  <p>I see the error below in the  the civi debug log. </p>
  
  <p>A thank you email is sent as requested.  I'm usisng CiviCRM 5.4.1 and Wordpress 4.9.9.</p>
  
  <p>What do I need to configure or change to fix this problem?</p>
  
  <p>ETA: The thank-you page used to display properly. I think it stopped working when Wordpress was automatically updated to 4.9.9. Any ideas? </p>
  
  <p>Update: 
  We are using credit cards through Paypal Website Payments Pro for payments. The transactions go through and are marked as complete. </p>
  
  <p>We also get this error when people register with a discount code giving them a free registration, thus no paypal transactions are required, or if they register using the pay later option.  For donations and memberships, the orginal donation or membership screen is displayed instead of the thank you screen.</p>
  
  <p>Update:</p>
  
  <p>I finally found the correct debug log. We have a subsite and I was looking at the main site ConfigAndLog. Here's the error and backtrace:</p>
  
  <pre><code>Jan 07 11:01:08  [info] $Fatal Error Details = Array
  (
       [message] =&gt; Could not find valid value for id
       [code] =&gt;  
  )
  
  
  Jan 07 11:01:08  [info] $backTrace = #0 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(381): &gt; CRM_Core_Error::backtrace("backTrace", TRUE)
  #1 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Request.php(121): CRM_Core_Error::fatal("Could not find valid value for id")
  #2 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Event/StateMachine/Registration.php(52): CRM_Utils_Request::retrieve("id", "Positive", Object(CRM_Event_Controller_Registration), TRUE)
  #3 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Event/Controller/Registration.php(47): CRM_Event_StateMachine_Registration-&gt;__construct(Object(CRM_Event_Controller_Registration), TRUE)
  #4 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(304): CRM_Event_Controller_Registration-&gt;__construct("Event Registration", TRUE, "null", NULL, "false")
  #5 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:15))
  #6 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
  #7 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm.php(1246): CRM_Core_Invoke::invoke((Array:3))
  #8 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/includes/civicrm.basepage.php(141): CiviCRM_For_WordPress-&gt;invoke()
  #9 [internal function](): CiviCRM_For_WordPress_Basepage-&gt;basepage_handler(Object(WP))
  #10 /var/www/vhosts/site/httpdocs/wp-includes/class-wp-hook.php(286): call_user_func_array((Array:2), (Array:1))
  #11 /var/www/vhosts/site/httpdocs/wp-includes/class-wp-hook.php(310): WP_Hook-&gt;apply_filters("", (Array:1))
  #12 /var/www/vhosts/site/httpdocs/wp-includes/plugin.php(515): WP_Hook-&gt;do_action((Array:1))
  13 /var/www/vhosts/site/httpdocs/wp-includes/class-wp.php(728): do_action_ref_array("wp", (Array:1))
  #14 /var/www/vhosts/site/httpdocs/wp-includes/functions.php(960): WP-&gt;main("")
  #15 /var/www/vhosts/site/httpdocs/wp-blog-header.php(16): wp()
  #16 /var/www/vhosts/site/httpdocs/index.php(17): require("/var/www/vhosts/site/httpdocs/wp-blog-header.php")
  #17 {main}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-07T19:48:15.067Z
Comments.Text: may be a duplicate of https://civicrm.stackexchange.com/questions/15531/thank-you-page-error-could-not-find-valued-for-id
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-07T19:48:32.490Z
Comments.Text: pls update your Q with payment processor details
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-07T19:51:45.737Z
Comments.Text: Any time you see an error with a yellow background like this, there should be an entry in the Civi log.  Are you checking the log in the [ConfigAndLog](https://civicrm.stackexchange.com/q/15931/12) directory?  You can also see these errors directly on the page with **Administer menu » System Settings » Debugging and Error Handling**.  Set both **Debugging** and **Backtrace** to **Yes** and save, then replicate the bug.  Please edit your question to include the full debug/backtrace.  Finally, please copy/paste the text, not a screenshot so others can search your error.  Thanks!
Comments.UserDisplayName: Jon G - Megaphone Tech
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-08T00:09:20.213Z
Comments.Text: you didn't say which version of PayPal you are using but i suspect this is duplicate of the ticket if pasted in first comment. did you read that other Question?
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-08T01:55:02.783Z
Comments.Text: Sorry....Yes, I read the first question. We're using PayPal Payments Pro.
Comments.UserDisplayName: kzburn
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-08T02:39:15.027Z
Comments.Text: Paypal - Website Payments Pro
Comments.UserDisplayName: kzburn
Tags: <wordpress><civievent><civimember><paypal>
Title: Thank you page not displaying
ThreadText: # Thank you page not displaying
  
  (Asked by: username_0 on 2019-01-07)
  
  Whenever someone registers for an event, this error displays instead of the thank you page:
  [![enter image description here](https://i.sstatic.net/u2Xlj.jpg)](https://i.sstatic.net/u2Xlj.jpg)
  
  I'm using Wordpress and I have a civicrm page, and I have the Wordpress base page set to the civicrm page on the CMS Database Integration page in civi. The url for the error page displayed is:
  ?page=CiviCRM&q=civicrm%2Fevent%2Fregister&\_qf\_ThankYou\_display=true&qfKey=
  
  I see the error below in the the civi debug log.
  
  A thank you email is sent as requested. I'm usisng CiviCRM 5.4.1 and Wordpress 4.9.9.
  
  What do I need to configure or change to fix this problem?
  
  ETA: The thank-you page used to display properly. I think it stopped working when Wordpress was automatically updated to 4.9.9. Any ideas?
  
  Update:
  We are using credit cards through Paypal Website Payments Pro for payments. The transactions go through and are marked as complete.
  
  We also get this error when people register with a discount code giving them a free registration, thus no paypal transactions are required, or if they register using the pay later option. For donations and memberships, the orginal donation or membership screen is displayed instead of the thank you screen.
  
  Update:
  
  I finally found the correct debug log. We have a subsite and I was looking at the main site ConfigAndLog. Here's the error and backtrace:
  
  ```
  Jan 07 11:01:08  [info] $Fatal Error Details = Array
  (
       [message] => Could not find valid value for id
       [code] =>  
  )
  
  Jan 07 11:01:08  [info] $backTrace = #0 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(381): > CRM_Core_Error::backtrace("backTrace", TRUE)
  #1 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Request.php(121): CRM_Core_Error::fatal("Could not find valid value for id")
  #2 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Event/StateMachine/Registration.php(52): CRM_Utils_Request::retrieve("id", "Positive", Object(CRM_Event_Controller_Registration), TRUE)
  #3 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Event/Controller/Registration.php(47): CRM_Event_StateMachine_Registration->__construct(Object(CRM_Event_Controller_Registration), TRUE)
  #4 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(304): CRM_Event_Controller_Registration->__construct("Event Registration", TRUE, "null", NULL, "false")
  #5 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:15))
  #6 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
  #7 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm.php(1246): CRM_Core_Invoke::invoke((Array:3))
  #8 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/includes/civicrm.basepage.php(141): CiviCRM_For_WordPress->invoke()
  #9 [internal function](): CiviCRM_For_WordPress_Basepage->basepage_handler(Object(WP))
  #10 /var/www/vhosts/site/httpdocs/wp-includes/class-wp-hook.php(286): call_user_func_array((Array:2), (Array:1))
  #11 /var/www/vhosts/site/httpdocs/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters("", (Array:1))
  #12 /var/www/vhosts/site/httpdocs/wp-includes/plugin.php(515): WP_Hook->do_action((Array:1))
  13 /var/www/vhosts/site/httpdocs/wp-includes/class-wp.php(728): do_action_ref_array("wp", (Array:1))
  #14 /var/www/vhosts/site/httpdocs/wp-includes/functions.php(960): WP->main("")
  #15 /var/www/vhosts/site/httpdocs/wp-blog-header.php(16): wp()
  #16 /var/www/vhosts/site/httpdocs/index.php(17): require("/var/www/vhosts/site/httpdocs/wp-blog-header.php")
  #17 {main}
  
  ```
  
  **Tags:** wordpress, civievent, civimember, paypal
  
  > **Comments:**
  > **username_1**: may be a duplicate of https://civicrm.stackexchange.com/questions/15531/thank-you-page-error-could-not-find-valued-for-id  
  > **username_1**: pls update your Q with payment processor details  
  > **username_2**: Any time you see an error with a yellow background like this, there should be an entry in the Civi log.  Are you checking the log in the [ConfigAndLog](https://civicrm.stackexchange.com/q/15931/12) directory?  You can also see these errors directly on the page with **Administer menu » System Settings » Debugging and Error Handling**.  Set both **Debugging** and **Backtrace** to **Yes** and save, then replicate the bug.  Please edit your question to include the full debug/backtrace.  Finally, please copy/paste the text, not a screenshot so others can search your error.  Thanks!  
  > **username_1**: you didn't say which version of PayPal you are using but i suspect this is duplicate of the ticket if pasted in first comment. did you read that other Question?  
  > **username_0**: Sorry....Yes, I read the first question. We're using PayPal Payments Pro.  
  > **username_0**: Paypal - Website Payments Pro  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2019-01-11. Score: 2
  
  I am fairly confident that your issue is that the WordPress `redirect_canonical` function is rewriting your unescaped CiviCRM URLs and redirecting to properly escaped URLs during the registration process. This would cause your session to be cleared during the redirect.
  
  I recently fixed the as much of the code as I could find where CiviCRM generates URLs and updated it to produce valid URLs that wouldn't be caught by `redirect_canonical`. The latest CiviCRM has the fixes (so upgrading is as always recommended) but here are the relevant PRs in case you want to back-port them to your version:
  
  * <https://github.com/civicrm/civicrm-core/pull/13043>
  * <https://github.com/civicrm/civicrm-core/pull/12969>
  * <https://github.com/civicrm/civicrm-core/pull/12968>
  
  As the question is also Paypal-related, you should also be aware of:
  
  * <https://civicrm.stackexchange.com/a/27958/520>
  
  I haven't verified that jgillmanjr's fix works, but the logic looks right to me.
  
  > **Comments:**
  > **username_4**: i'm scratching my head on this for a couple of weeks now trying to get an installation updated from 5.28 .. where it worked fine. also with 5.33 which i tested for verification. but with 5.44 i can't get no 'thank you' page displayed after registration.  URLs look fine - the key after _qf_Confirm_display=true&qfKey= is identical with the one on _qf_ThankYou_display=true&qfKey=  we are *not* using any payment provider, civicrm 5.44, wordpress 5.8.2  
  
  ---
  
  