From 5bd56e68464d87279c6f7262bc3d2318b539559f Mon Sep 17 00:00:00 2001 From: Capo Date: Mon, 7 Oct 2013 18:57:03 +0200 Subject: [PATCH] Change assignation in log of changes made via API (CRM-13549) --- CRM/Core/BAO/Log.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CRM/Core/BAO/Log.php b/CRM/Core/BAO/Log.php index 081826474a..4c949445ed 100644 --- a/CRM/Core/BAO/Log.php +++ b/CRM/Core/BAO/Log.php @@ -88,6 +88,14 @@ class CRM_Core_BAO_Log extends CRM_Core_DAO_Log { $userID = $session->get('userID'); } + if (!$userID) { + $api_key = CRM_Utils_Request::retrieve('api_key', 'String', $store, FALSE, NULL, 'REQUEST'); + + if ($api_key && strtolower($api_key) != 'null') { + $userID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $api_key, 'id', 'api_key'); + } + } + if (!$userID) { $userID = $contactID; } -- 2.25.1