Skip to content

Commit

Permalink
show honor roll only if it's enabled for the PCP page
Browse files Browse the repository at this point in the history
  • Loading branch information
kurund authored May 24, 2022
1 parent 51ae64d commit 76dd7dd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 25 deletions.
37 changes: 21 additions & 16 deletions CRM/Contribute/Form/Contribution/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
}

Expand Down
23 changes: 14 additions & 9 deletions CRM/Contribute/Form/Contribution/ThankYou.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
}
}
Expand Down

0 comments on commit 76dd7dd

Please sign in to comment.