From 42caecef4c118522f54a3f9ba783571edda82236 Mon Sep 17 00:00:00 2001 From: Kevin Cristiano <kcristiano@kcristiano.com> Date: Tue, 18 Dec 2018 14:28:59 -0500 Subject: [PATCH] Fix Synchronize users for Multi-Site. Props Christian Wach --- civicrm/CRM/Utils/System/WordPress.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/civicrm/CRM/Utils/System/WordPress.php b/civicrm/CRM/Utils/System/WordPress.php index 493e174f79..09b79d672c 100644 --- a/civicrm/CRM/Utils/System/WordPress.php +++ b/civicrm/CRM/Utils/System/WordPress.php @@ -815,11 +815,13 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { $contactCreated = 0; $contactMatching = 0; - global $wpdb; - $wpUserIds = $wpdb->get_col("SELECT $wpdb->users.ID FROM $wpdb->users"); + // previously used $wpdb - which means WordPress *must* be bootstrapped + $wpUsers = get_users(array( + 'blog_id' => get_current_blog_id(), + 'number' => -1, + )); - foreach ($wpUserIds as $wpUserId) { - $wpUserData = get_userdata($wpUserId); + foreach ($wpUsers as $wpUserData) { $contactCount++; if ($match = CRM_Core_BAO_UFMatch::synchronizeUFMatch($wpUserData, $wpUserData->$id, -- GitLab