diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 2ef3a2a863c5..6dd090a72d3f 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -1385,22 +1385,27 @@ public static function processOnBehalfOrganization(&$behalfOrganization, &$conta */ public static function processPcp(&$page, $params): array { $params['pcp_made_through_id'] = $page->_pcpId; - $page->assign('pcpBlock', TRUE); - if (!empty($params['pcp_display_in_roll']) && empty($params['pcp_roll_nickname'])) { - $params['pcp_roll_nickname'] = ts('Anonymous'); - $params['pcp_is_anonymous'] = 1; - } - else { - $params['pcp_is_anonymous'] = 0; - } - foreach ([ - 'pcp_display_in_roll', - 'pcp_is_anonymous', - 'pcp_roll_nickname', - 'pcp_personal_note', - ] as $val) { - if (!empty($params[$val])) { - $page->assign($val, $params[$val]); + + $page->assign('pcpBlock', FALSE); + // display honor roll data only if it's enabled for the PCP page + if (!empty($page->_pcpInfo['is_honor_roll'])) { + $page->assign('pcpBlock', TRUE); + if (!empty($params['pcp_display_in_roll']) && empty($params['pcp_roll_nickname'])) { + $params['pcp_roll_nickname'] = ts('Anonymous'); + $params['pcp_is_anonymous'] = 1; + } + else { + $params['pcp_is_anonymous'] = 0; + } + foreach ([ + 'pcp_display_in_roll', + 'pcp_is_anonymous', + 'pcp_roll_nickname', + 'pcp_personal_note', + ] as $val) { + if (!empty($params[$val])) { + $page->assign($val, $params[$val]); + } } } diff --git a/CRM/Contribute/Form/Contribution/ThankYou.php b/CRM/Contribute/Form/Contribution/ThankYou.php index 623c9dd26eed..91a8bcbcc0b8 100644 --- a/CRM/Contribute/Form/Contribution/ThankYou.php +++ b/CRM/Contribute/Form/Contribution/ThankYou.php @@ -142,15 +142,20 @@ public function buildQuickForm() { //pcp elements if ($this->_pcpId) { $qParams .= "&pcpId={$this->_pcpId}"; - $this->assign('pcpBlock', TRUE); - foreach ([ - 'pcp_display_in_roll', - 'pcp_is_anonymous', - 'pcp_roll_nickname', - 'pcp_personal_note', - ] as $val) { - if (!empty($this->_params[$val])) { - $this->assign($val, $this->_params[$val]); + $this->assign('pcpBlock', FALSE); + + // display honor roll data only if it's enabled for the PCP page + if (!empty($this->_pcpInfo['is_honor_roll'])) { + $this->assign('pcpBlock', TRUE); + foreach ([ + 'pcp_display_in_roll', + 'pcp_is_anonymous', + 'pcp_roll_nickname', + 'pcp_personal_note', + ] as $val) { + if (!empty($this->_params[$val])) { + $this->assign($val, $this->_params[$val]); + } } } }