Answers.Body: <p>A ticket describing this bad behavior now exists at <a href="https://lab.civicrm.org/dev/core/-/issues/4500" rel="nofollow noreferrer">https://lab.civicrm.org/dev/core/-/issues/4500</a> , which describes the technical causes of the bad behavior, mentions another set of actions that can lead to this problem, and provides an alternative workaround (manually updating the values in <code>civicrm_uf_match</code> via SQL).</p>
  <p>Hopefully it will also serve as a focal point for moving toward a fix and/or standardized &quot;best practices&quot; to avoid or resolve this issue if/when it arises.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-15T20:02:19.863Z
Answers.LastActivityDate: 2023-08-15T20:02:19.863Z
Answers.UserDisplayName: TwoMice
Answers.Body: <p>I have seen this when the <code>uf_match</code> table does not have the proper values for WP Id (<code>uf_id</code>), Contact ID (<code>contact_id</code>) and email (<code>uf_name</code>).</p>
  
  <p>I don't know why this occurs, I've not been able to track it down, but I suspect it is when the <code>uf_id</code> and <code>contact_id</code> do not have the email in use by WP.  </p>
  
  <p>You can user API Explorer <code>/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm/api</code> to display the records or do a query on the <code>civicrm_uf_match</code> table.   </p>
  
  <p>To fix, I have deleted the 'bad contacts (merging if data needs to be retained) and then updating the <code>uf_match</code> records so this does not re-occur.  </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-15T17:56:57.557Z
Answers.Text: That will be it. I did not update the contact IDs in that table when I moved to Wordpress, so the IDs refer to Joomla user IDs, not Wordpress Users. Seems obvious now that I should have done that, but I don't believe it was in the instructions I followed. Thank you!
Answers.UserDisplayName: fred2
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-17T08:48:47.327Z
Answers.Text: @fred2 It is mentioned here: https://docs.civicrm.org/sysadmin/en/latest/misc/switch-cms/#empty-the-civicrm_uf_match-table but if you can improve the documentation, please submit a change.
Answers.UserDisplayName: Aidan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-15T17:23:58.560Z
Answers.LastActivityDate: 2018-12-15T17:23:58.560Z
Answers.UserDisplayName: Kevin Cristiano
Body: <p>I have recently migrated a CiviCRM instance from Joomla to Wordpress, everything went smoothly.</p>
  
  <p>The installation is using CiviCRM 5.7.2 and PHP 7.2.</p>
  
  <p>We're now seeing a peculiar problem where, when users are making general use of CiviCRM, literally 100s of duplicate contacts are created of whichever user is working.</p>
  
  <p>The duplicates accumulate very quickly. In about 10 minutes of experimentation with CiviMail today, I managed to create 249 duplicate contacts of myself. </p>
  
  <p>In testing for this question, I created 25 contacts simply by searching for 'contacts created today' in advanced search.</p>
  
  <p>Just about any action appears to create these duplicates.</p>
  
  <p>When deleting them, CiviCRM will warn me that 'you are currently logged in as' one of the duplicates and therefore it cannot be deleted. Obviously my user account should not be associated with a just-created contact.</p>
  
  <p>My guess is that this may be caused by something like a missing database constraint, but I'm at a bit of a loss as to where to start looking.</p>
  
  <p>Any ideas?</p>
  
Tags: <wordpress><contacts><duplicate-contacts><user-account>
Title: 100s of duplicate contacts created of current user when using CiviCRM
ThreadText: # 100s of duplicate contacts created of current user when using CiviCRM
  
  (Asked by: username_0 on 2018-12-15)
  
  I have recently migrated a CiviCRM instance from Joomla to Wordpress, everything went smoothly.
  
  The installation is using CiviCRM 5.7.2 and PHP 7.2.
  
  We're now seeing a peculiar problem where, when users are making general use of CiviCRM, literally 100s of duplicate contacts are created of whichever user is working.
  
  The duplicates accumulate very quickly. In about 10 minutes of experimentation with CiviMail today, I managed to create 249 duplicate contacts of myself.
  
  In testing for this question, I created 25 contacts simply by searching for 'contacts created today' in advanced search.
  
  Just about any action appears to create these duplicates.
  
  When deleting them, CiviCRM will warn me that 'you are currently logged in as' one of the duplicates and therefore it cannot be deleted. Obviously my user account should not be associated with a just-created contact.
  
  My guess is that this may be caused by something like a missing database constraint, but I'm at a bit of a loss as to where to start looking.
  
  Any ideas?
  
  **Tags:** wordpress, contacts, duplicate-contacts, user-account
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2018-12-15. Score: 7 | Accepted answer
  
  I have seen this when the `uf_match` table does not have the proper values for WP Id (`uf_id`), Contact ID (`contact_id`) and email (`uf_name`).
  
  I don't know why this occurs, I've not been able to track it down, but I suspect it is when the `uf_id` and `contact_id` do not have the email in use by WP.
  
  You can user API Explorer `/wp-admin/admin.php?page=CiviCRM&q=civicrm/api` to display the records or do a query on the `civicrm_uf_match` table.
  
  To fix, I have deleted the 'bad contacts (merging if data needs to be retained) and then updating the `uf_match` records so this does not re-occur.
  
  > **Comments:**
  > **username_0**: That will be it. I did not update the contact IDs in that table when I moved to Wordpress, so the IDs refer to Joomla user IDs, not Wordpress Users. Seems obvious now that I should have done that, but I don't believe it was in the instructions I followed. Thank you!  
  > **username_3**: @username_0 It is mentioned here: https://docs.civicrm.org/sysadmin/en/latest/misc/switch-cms/#empty-the-civicrm_uf_match-table but if you can improve the documentation, please submit a change.  
  
  ---
  
  ### Answer by username_1 on 2023-08-15. Score: 1
  
  A ticket describing this bad behavior now exists at <https://lab.civicrm.org/dev/core/-/issues/4500> , which describes the technical causes of the bad behavior, mentions another set of actions that can lead to this problem, and provides an alternative workaround (manually updating the values in `civicrm_uf_match` via SQL).
  
  Hopefully it will also serve as a focal point for moving toward a fix and/or standardized "best practices" to avoid or resolve this issue if/when it arises.
  
  
  ---
  
  