expand the scope of the $contactId variable
authorAndrew Engelbrecht <sudoman@ninthfloor.org>
Tue, 10 Jan 2017 20:58:55 +0000 (15:58 -0500)
committerAndrew Engelbrecht <sudoman@ninthfloor.org>
Tue, 10 Jan 2017 20:58:55 +0000 (15:58 -0500)
this variable is used elsewhere in the outer function, so it should not
be limited to the lambda function.

memberdashboard.php

index f37cb4508124631e61712b045a1ac6e83024d02f..3cb09267d40d8e6193bd6527fa40669851463e52 100644 (file)
@@ -125,10 +125,11 @@ function memberdashboard_civicrm_post($op, $objectName, $objectId, &$objectRef)
       // TODO: Extract all of this to a class for clarity and
       // organization's sake.
 
-      // Get the oldest join date for the contact's memberships.
-      $getDao = function () use ($objectRef) {
+      $contactId = $objectRef->contact_id;
 
-          $contactId = $objectRef->contact_id;
+      $getDao = function () use ($contactId) {
+
+          // Get the oldest join date for the contact's memberships.
           $dao = CRM_Core_DAO::executeQuery(
             'SELECT join_date FROM civicrm_membership WHERE contact_id=%1 ORDER BY join_date ASC LIMIT 1',
             array( 1 => array($contactId, 'Integer') )