From d2f741468df5daa3581e504ffca7bac29151fb80 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 29 Nov 2023 22:38:29 +1300 Subject: [PATCH] Thank you page notice - ensure friendText & linkText is assigned --- CRM/Contribute/Form/Contribution/ThankYou.php | 12 ++++++++++++ CRM/Contribute/Form/ContributionBase.php | 10 ---------- CRM/Friend/Form.php | 7 ++----- CRM/PCP/Page/PCPInfo.php | 4 ++-- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/ThankYou.php b/CRM/Contribute/Form/Contribution/ThankYou.php index 65490ef892..d24a83b607 100644 --- a/CRM/Contribute/Form/Contribution/ThankYou.php +++ b/CRM/Contribute/Form/Contribution/ThankYou.php @@ -49,6 +49,15 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont $this->assign('thankyou_footer', CRM_Utils_Array::value('thankyou_footer', $this->_values)); $this->assign('max_reminders', CRM_Utils_Array::value('max_reminders', $this->_values)); $this->assign('initial_reminder_day', CRM_Utils_Array::value('initial_reminder_day', $this->_values)); + // Link (button) for users to create their own Personal Campaign page + if ($linkText = CRM_PCP_BAO_PCP::getPcpBlockStatus($this->getContributionPageID(), 'contribute')) { + $linkTextUrl = CRM_Utils_System::url('civicrm/contribute/campaign', + "action=add&reset=1&pageId=' . $this->getContributionPageID() . '&component=contribute", + FALSE, NULL, TRUE + ); + } + $this->assign('linkTextUrl', $linkTextUrl ?? NULL); + $this->assign('linkText', $linkText); $this->setTitle(CRM_Utils_Array::value('thankyou_title', $this->_values)); // Make the contributionPageID available to the template $this->assign('contributionPageID', $this->_id); @@ -249,6 +258,9 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont $subUrl = "eid={$this->_id}&pcomponent=contribute"; $tellAFriend = TRUE; } + else { + $this->assign('friendText'); + } if ($tellAFriend) { if ($this->_action & CRM_Core_Action::PREVIEW) { diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 1af2edb076..9dff9a2362 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -483,16 +483,6 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { $this->_pcpInfo = $pcp['pcpInfo']; } - // Link (button) for users to create their own Personal Campaign page - if ($linkText = CRM_PCP_BAO_PCP::getPcpBlockStatus($this->_id, 'contribute')) { - $linkTextUrl = CRM_Utils_System::url('civicrm/contribute/campaign', - "action=add&reset=1&pageId={$this->_id}&component=contribute", - FALSE, NULL, TRUE - ); - $this->assign('linkTextUrl', $linkTextUrl); - $this->assign('linkText', $linkText); - } - $this->assign('pledgeBlock', !empty($this->_values['pledge_block_id'])); // @todo - move this check to `getMembershipBlock` diff --git a/CRM/Friend/Form.php b/CRM/Friend/Form.php index 0441951d1e..939975446a 100644 --- a/CRM/Friend/Form.php +++ b/CRM/Friend/Form.php @@ -285,8 +285,6 @@ class CRM_Friend_Form extends CRM_Core_Form { FALSE, NULL, TRUE, TRUE ); - $this->assign('linkTextUrl', $linkTextUrl); - $this->assign('linkText', $linkText); } } elseif ($this->_entityTable === 'civicrm_event') { @@ -297,11 +295,10 @@ class CRM_Friend_Form extends CRM_Core_Form { "action=add&reset=1&pageId={$defaults['entity_id']}&component=event", FALSE, NULL, TRUE, TRUE); - $this->assign('linkTextUrl', $linkTextUrl); - $this->assign('linkText', $linkText); } } - + $this->assign('linkTextUrl', $linkTextUrl ?? NULL); + $this->assign('linkText', $linkText ?? NULL); $this->setTitle($defaults['thankyou_title']); $this->assign('thankYouText', $defaults['thankyou_text']); } diff --git a/CRM/PCP/Page/PCPInfo.php b/CRM/PCP/Page/PCPInfo.php index 18496ef20e..12dc8f9163 100644 --- a/CRM/PCP/Page/PCPInfo.php +++ b/CRM/PCP/Page/PCPInfo.php @@ -206,9 +206,9 @@ class CRM_PCP_Page_PCPInfo extends CRM_Core_Page { TRUE, NULL, TRUE, TRUE ); - $this->assign('linkTextUrl', $linkTextUrl); - $this->assign('linkText', $pcpBlock->link_text); } + $this->assign('linkTextUrl', $linkTextUrl ?? NULL); + $this->assign('linkText', $pcpBlock->link_text ?? NULL); $this->assign('honor', $honor); $this->assign('total', $totalAmount ?: '0.0'); -- 2.25.1