diff --git a/civicrm/CRM/Utils/System/WordPress.php b/civicrm/CRM/Utils/System/WordPress.php index f2df6c84761c6186d0ba4a3172bf9fe2a2f5799b..7bdb1e9ea1c3d3ccff60b5ce8517cd0c540953fa 100644 --- a/civicrm/CRM/Utils/System/WordPress.php +++ b/civicrm/CRM/Utils/System/WordPress.php @@ -767,11 +767,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,