Use API to fetch contact.
authorDavid Thompson <davet@gnu.org>
Thu, 2 Oct 2014 14:51:05 +0000 (10:51 -0400)
committerDavid Thompson <davet@gnu.org>
Thu, 2 Oct 2014 14:51:05 +0000 (10:51 -0400)
* CRM/Memberdashboard/Page/MemberDashboard.php (loadContact): Use API.
  (run): '$contact' is now an array.

CRM/Memberdashboard/Page/MemberDashboard.php

index 8164dc92bd952d1b61bff2af866dc74ded921490..5029510df83649238166e06f0279dd6722ba5b03 100644 (file)
@@ -37,10 +37,9 @@ class CRM_Memberdashboard_Page_MemberDashboard extends CRM_Core_Page {
    * @return CRM_Contact
    */
   function loadContact() {
-    $session = CRM_Core_Session::singleton();
-    $params = array('contact_id' => $session->get('userID'));
-    $defaults = array();
-    return CRM_Contact_BAO_Contact::retrieve($params, $defaults);
+    return civicrm_api3('contact', 'getsingle', array(
+      'id' => CRM_Core_Session::singleton()->get('userID')
+    ));
   }
 
   /**
@@ -49,7 +48,7 @@ class CRM_Memberdashboard_Page_MemberDashboard extends CRM_Core_Page {
    * @return Title string
    */
   function pageTitle() {
-    return ts('Welcome, ') . $this->contact->first_name . '!';
+    return ts('Welcome, ') . $this->contact['first_name'] . '!';
   }
 
   function run() {