From 093fd901a961e41cb34ba8b528cf0e5dc5b3f593 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Fri, 26 Mar 2021 19:44:37 +1100 Subject: [PATCH] [REF] Fix error where entryURL does not contain id of the contribution page when coming from a shortcode which leads to infinite redirect loop if session timesout Add in comment and expand fix to cover event registratons as well --- CRM/Core/Controller.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CRM/Core/Controller.php b/CRM/Core/Controller.php index 68c6531858..0a5f6482e8 100644 --- a/CRM/Core/Controller.php +++ b/CRM/Core/Controller.php @@ -241,6 +241,11 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { // in this case we'll also cache the url as a hidden form variable, this allows us to // redirect in case the session has disappeared on us $this->_entryURL = CRM_Utils_System::makeURL(NULL, TRUE, FALSE, NULL, TRUE); + // In WordPress Shortcodes the standard entryURL generated via makeURL doesn't generally have id=x&reset=1 included so we add them here + // This prevents infinite loops caused when the session has timed out. + if (stripos($this->_entryURL, 'id') === FALSE && (stripos($this->_entryURL, 'transact') !== FALSE || stripos($this->_entryURL, 'register') !== FALSE)) { + $this->_entryURL .= '&id=' . CRM_Utils_Request::retrieveValue('id', 'Positive') . '&reset=1'; + } $this->set('entryURL', $this->_entryURL); } -- 2.25.1