From: David Thompson Date: Thu, 2 Oct 2014 14:51:05 +0000 (-0400) Subject: Use API to fetch contact. X-Git-Tag: v0.1~52 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c3a7f72a610e8047208daf33c75628379ea17097;p=org.fsf.memberdashboard.git Use API to fetch contact. * CRM/Memberdashboard/Page/MemberDashboard.php (loadContact): Use API. (run): '$contact' is now an array. --- diff --git a/CRM/Memberdashboard/Page/MemberDashboard.php b/CRM/Memberdashboard/Page/MemberDashboard.php index 8164dc9..5029510 100644 --- a/CRM/Memberdashboard/Page/MemberDashboard.php +++ b/CRM/Memberdashboard/Page/MemberDashboard.php @@ -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() {