From eb3dce40a6905e0ae4d0a3807fcce0a43f8ffad3 Mon Sep 17 00:00:00 2001 From: poliphilochu Date: Wed, 17 Apr 2024 22:10:52 +0800 Subject: [PATCH] refs #40383. Fix civicrm_pcp shortening issue and save URLs to DB --- CRM/Contribute/Page/ContributionPage.php | 4 ++++ CRM/Core/Page/AJAX/SaveShortenURL.php | 2 +- templates/CRM/Contribute/Page/ContributionPageEdit.tpl | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CRM/Contribute/Page/ContributionPage.php b/CRM/Contribute/Page/ContributionPage.php index 549e96ee1..58c370033 100644 --- a/CRM/Contribute/Page/ContributionPage.php +++ b/CRM/Contribute/Page/ContributionPage.php @@ -334,6 +334,10 @@ function run() { if ($shorten) { $this->assign('shorten', $shorten); } + $shorten_pcp = CRM_Core_OptionGroup::getValue('shorten_url', 'civicrm_pcp.'.$id, 'name', 'String', 'value'); + if ($shorten_pcp) { + $this->assign('shorten_pcp', $shorten_pcp); + } // statistics CRM_Utils_System::setTitle(ts('Dashlets')." - ".$page['title']); diff --git a/CRM/Core/Page/AJAX/SaveShortenURL.php b/CRM/Core/Page/AJAX/SaveShortenURL.php index 43f4bc6ed..cb2a1cc78 100644 --- a/CRM/Core/Page/AJAX/SaveShortenURL.php +++ b/CRM/Core/Page/AJAX/SaveShortenURL.php @@ -4,7 +4,7 @@ static function run() { $pageId = CRM_Utils_Request::retrieve('page_id', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, 'REQUEST'); $pageType = CRM_Utils_Request::retrieve('page_type', 'String', CRM_Core_DAO::$_nullObject, TRUE, NULL, 'REQUEST'); $shorten = CRM_Utils_Request::retrieve('shorten', 'String', CRM_Core_DAO::$_nullObject, TRUE, NULL, 'REQUEST'); - if (in_array($pageType, array('civicrm_contribution_page', 'civicrm_event.info', 'civicrm_event.register', 'civicrm_uf_group'))) { + if (in_array($pageType, array('civicrm_contribution_page', 'civicrm_pcp', 'civicrm_event.info', 'civicrm_event.register', 'civicrm_uf_group'))) { $exists = CRM_Core_OptionGroup::getValue('shorten_url', $pageType.'.'.$pageId, 'name', 'String', 'id'); $groupParams = array( 'name' => 'shorten_url', diff --git a/templates/CRM/Contribute/Page/ContributionPageEdit.tpl b/templates/CRM/Contribute/Page/ContributionPageEdit.tpl index d233829d3..a4da8f743 100644 --- a/templates/CRM/Contribute/Page/ContributionPageEdit.tpl +++ b/templates/CRM/Contribute/Page/ContributionPageEdit.tpl @@ -98,12 +98,12 @@ {ts}New personal campaign page{/ts}
{ts}You can provide this URL to supporters for creating new Personal Campaign Pages.{/ts}
- + {ts}Copy{/ts} - {ts}Shorten URL{/ts} + {ts}Shorten URL{/ts}