From: Andrew Engelbrecht Date: Tue, 10 Jan 2017 20:58:55 +0000 (-0500) Subject: expand the scope of the $contactId variable X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5ee135318f837614088166474def1cd768c3bcd8;p=org.fsf.memberdashboard.git expand the scope of the $contactId variable this variable is used elsewhere in the outer function, so it should not be limited to the lambda function. --- diff --git a/memberdashboard.php b/memberdashboard.php index f37cb45..3cb0926 100644 --- a/memberdashboard.php +++ b/memberdashboard.php @@ -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') )