Enotice fix, pledge block on UserDashboard
authorEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 10 Feb 2023 00:17:51 +0000 (13:17 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 10 Feb 2023 00:23:33 +0000 (13:23 +1300)
CRM/Pledge/Page/UserDashboard.php

index a30b8bcf9cf2af532253156e537f6042a4cc568f..0c8b74375d19ff68196c699fc47f46443da51274 100644 (file)
@@ -19,7 +19,7 @@ class CRM_Pledge_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBoard
   /**
    * called when action is browse.
    */
-  public function listPledges() {
+  public function listPledges(): void {
     $controller = new CRM_Core_Controller_Simple(
       'CRM_Pledge_Form_Search',
       ts('Pledges'),
@@ -35,25 +35,20 @@ class CRM_Pledge_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBoard
     $controller->process();
     $controller->run();
 
-    // add honor block.
-    $honorParams = [];
+    // Add honor block.
     $honorParams = CRM_Pledge_BAO_Pledge::getHonorContacts($this->_contactId);
-    if (!empty($honorParams)) {
-      // assign vars to templates
-      $this->assign('pledgeHonorRows', $honorParams);
-      $this->assign('pledgeHonor', TRUE);
-    }
-    $session = CRM_Core_Session::singleton();
-    $loggedUserID = $session->get('userID');
-    $this->assign('loggedUserID', $loggedUserID);
+    $this->assign('pledgeHonorRows', $honorParams);
+    $this->assign('pledgeHonor', !empty($honorParams));
+    $this->assign('loggedUserID', CRM_Core_Session::getLoggedInContactID());
   }
 
   /**
-   * the main function that is called when the page
-   * loads, it decides the which action has to be taken for the page.
+   * The main function that is called when the page loads.
+   *
+   * @throws \CRM_Core_Exception
    */
-  public function run() {
-    parent::preProcess();
+  public function run(): void {
+    $this->preProcess();
     $this->listPledges();
   }