From 4a94e641e174824c87472ef2e88f3c51d7ca516a Mon Sep 17 00:00:00 2001 From: Andrew Hunt Date: Wed, 27 Mar 2019 11:43:34 -0400 Subject: [PATCH] User dash: show most recent contributions, not earliest --- CRM/Contribute/Page/UserDashboard.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CRM/Contribute/Page/UserDashboard.php b/CRM/Contribute/Page/UserDashboard.php index 9b4e614c38..1efad9f386 100644 --- a/CRM/Contribute/Page/UserDashboard.php +++ b/CRM/Contribute/Page/UserDashboard.php @@ -37,7 +37,10 @@ class CRM_Contribute_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBo */ public function listContribution() { $rows = civicrm_api3('Contribution', 'get', [ - 'options' => ['limit' => 12], + 'options' => [ + 'limit' => 12, + 'sort' => 'receive_date DESC', + ], 'sequential' => 1, 'contact_id' => $this->_contactId, 'return' => [ @@ -54,6 +57,9 @@ class CRM_Contribute_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBo ], ])['values']; + // We want oldest first, just among the most recent contributions + $rows = array_reverse($rows); + foreach ($rows as $index => $row) { // This is required for tpl logic. We should move away from hard-code this to adding an array of actions to the row // which the tpl can iterate through - this should allow us to cope with competing attempts to add new buttons -- 2.25.1