Contact Dashboard Personal Campaign Pages section repeats Campaign rows for each user-created PCP
Looks to me like a regression of CRM-11340.
PR Raised https://github.com/civicrm/civicrm-core/pull/12369
To reproduce on dmaster.demo.civicrm.org:
- Ensure exixstence of at least 2 1 contriubution page with Personal Campaign Pages enabled; this recipe is easier if you remove the admin approval requirement, but that's not relevant to the issue.
- As anonymous user, visit the URL to create your own PCP page for this campaign and complete the process.
- Repeat step 2 to create a second PCP page for this campaign.
- As admin, visit http://dmaster.demo.civicrm.org/civicrm/admin/pcp?reset=1&action=browse and observe there are at least two PCP pages for this campaign. Also ensure neither of these two pages is owned by the account you're currently logged in with.
- Visit the user dashboard at http://dmaster.demo.civicrm.org/civicrm/user?reset=1, and observe this campaign is listed twice under "create a Personal Campaign Page", ass in attached screenshot:
Preliminary testing shows the following patch fixes the issue, but unsure of possible side effects:
diff --git a/CRM/PCP/BAO/PCP.php b/CRM/PCP/BAO/PCP.php
index b21a3a2..65ef434 100644
--- a/CRM/PCP/BAO/PCP.php
+++ b/CRM/PCP/BAO/PCP.php
@@ -184,7 +184,7 @@ FROM civicrm_pcp_block block
LEFT JOIN civicrm_pcp pcp ON pcp.pcp_block_id = block.id
WHERE block.is_active = 1
{$clause}
-GROUP BY block.id, pcp.id
+GROUP BY block.id
ORDER BY target_entity_type, target_entity_id
";
$pcpBlockDao = CRM_Core_DAO::executeQuery($query);