Answers.Body: <p>You should go look at your civicrm_uf_match table in the database.  If you ever cleared out users in bulk or moved from one site to another, you probably have entries in there for users or contacts that don't exist.  The purpose of the tables is to link users from your CMS (the uf_id column) with contacts from CiviCRM (the contact_id) column.</p>
  
  <p>The (relatively) foolproof method to deal with this is the following</p>
  
  <ol>
  <li><p>Log out from WordPress</p></li>
  <li><p>Run the following query, which will empty that table:</p>
  
  <pre><code>DELETE FROM civicrm_uf_match;
  </code></pre></li>
  <li><p>Log in to WordPress again.  This should cause CiviCRM to find (or create yet another copy of) your corresponding contact record.</p></li>
  <li><p>Go to CiviCRM, and in the menu, select Administer > Users and Permissions > Synchronize Users to Contacts and follow the prompts.</p></li>
  <li><p>It will find or create a contact for each of your WordPress users.  You may find that it generates a handful of duplicates.  You might run a Find and Merge Duplicate Contacts search on individuals when you're done: this may have generated more duplicates, and it sounds like you may already have a bunch of duplicates.</p></li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-31T20:10:33.657Z
Answers.LastActivityDate: 2015-03-31T20:10:33.657Z
Answers.UserDisplayName: Andie Hunt
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:01:06.643Z
Answers.LastActivityDate: 2023-08-15T20:01:06.643Z
Answers.UserDisplayName: TwoMice
Answers.Body: <p>I have seen this problem in Drupal when a logged in administrator uses a front-end form to register a participant in an event or sign a user up for membership instead of using the backend form. Try to always use the options for New Participant or New Membership in the menu system or from the Contact Summary form. Using the sign up pages that you Manage for the public leads to problems like this.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-31T03:27:09.043Z
Answers.LastActivityDate: 2015-03-31T03:27:09.043Z
Answers.UserDisplayName: Joe Murray
Body: <p>I haven't quite worked out under which circumstances, but our WordPress (4.0.1) and Civi (4.5.2) seems to create duplicate contacts for the same WordPress user. I think it happens when they log in, but I can't be sure. It doesn't happen to most people, just some--including me! </p>
  
  <p>I now have 5 contacts with my name. The first one has all the details associated with it including membership and activities, the others have minimal information but unfortunately they have some activities and contributions (this has been caused by other administrators picking the "wrong" contact when assigning contributions). I've logged in many more than 5 times, so not sure how this happened. Any tips on diagnosing the problem?</p>
  
  <p>Related to this, if I try and merge duplicate contacts, it now loses the activities and contributions. I'm sure that in previous versions of Civi, this worked OK, but at the moment I'm having to manually move the activities and contributions using SQL. Is there a better way?</p>
  
  <p>Thanks!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-11T07:02:27.640Z
Comments.Text: I now have a theory that it happens when there are already 2 or more records with the same email address. Perhaps if the Civi can't find a _single_ contact with the matching email, then it creates a new one?
  
  This is a problem for me because several family members share an email address.
Comments.UserDisplayName: DenisH
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-30T19:03:11.137Z
Comments.Text: I also have this problem on WordPress. When you merge users to contacts, any new email addresses result in a new contact record. You then have to experiment with the various dedup rules to resolve. And I have seen that if you use any of the contribution forms while logged into WordPress, your WordPress email address overrides your CiviCRM contact address. There is a no-overwrite extension but I have not tried it. See http://civicrm.stackexchange.com/questions/19/confusion-on-wordpress-between-logins-and-contacts.
Comments.UserDisplayName: P a u l
Tags: <wordpress><duplicate-contacts>
Title: Wordpress duplicates my contacts
ThreadText: # Wordpress duplicates my contacts
  
  (Asked by: username_0 on 2015-03-30)
  
  I haven't quite worked out under which circumstances, but our WordPress (4.0.1) and Civi (4.5.2) seems to create duplicate contacts for the same WordPress user. I think it happens when they log in, but I can't be sure. It doesn't happen to most people, just some--including me!
  
  I now have 5 contacts with my name. The first one has all the details associated with it including membership and activities, the others have minimal information but unfortunately they have some activities and contributions (this has been caused by other administrators picking the "wrong" contact when assigning contributions). I've logged in many more than 5 times, so not sure how this happened. Any tips on diagnosing the problem?
  
  Related to this, if I try and merge duplicate contacts, it now loses the activities and contributions. I'm sure that in previous versions of Civi, this worked OK, but at the moment I'm having to manually move the activities and contributions using SQL. Is there a better way?
  
  Thanks!
  
  **Tags:** wordpress, duplicate-contacts
  
  > **Comments:**
  > **username_1**: I also have this problem on WordPress. When you merge users to contacts, any new email addresses result in a new contact record. You then have to experiment with the various dedup rules to resolve. And I have seen that if you use any of the contribution forms while logged into WordPress, your WordPress email address overrides your CiviCRM contact address. There is a no-overwrite extension but I have not tried it. See http://civicrm.stackexchange.com/questions/19/confusion-on-wordpress-between-logins-and-contacts.  
  > **username_0**: I now have a theory that it happens when there are already 2 or more records with the same email address. Perhaps if the Civi can't find a _single_ contact with the matching email, then it creates a new one?  This is a problem for me because several family members share an email address.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2015-03-31. Score: 5
  
  You should go look at your civicrm\_uf\_match table in the database. If you ever cleared out users in bulk or moved from one site to another, you probably have entries in there for users or contacts that don't exist. The purpose of the tables is to link users from your CMS (the uf\_id column) with contacts from CiviCRM (the contact\_id) column.
  
  The (relatively) foolproof method to deal with this is the following
  
  1. Log out from WordPress
  2. Run the following query, which will empty that table:
  
     ```
     DELETE FROM civicrm_uf_match;
  
     ```
  3. Log in to WordPress again. This should cause CiviCRM to find (or create yet another copy of) your corresponding contact record.
  4. Go to CiviCRM, and in the menu, select Administer > Users and Permissions > Synchronize Users to Contacts and follow the prompts.
  5. It will find or create a contact for each of your WordPress users. You may find that it generates a handful of duplicates. You might run a Find and Merge Duplicate Contacts search on individuals when you're done: this may have generated more duplicates, and it sounds like you may already have a bunch of duplicates.
  
  
  ---
  
  ### Answer by username_3 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.
  
  
  ---
  
  ### Answer by username_4 on 2015-03-31. Score: 1
  
  I have seen this problem in Drupal when a logged in administrator uses a front-end form to register a participant in an event or sign a user up for membership instead of using the backend form. Try to always use the options for New Participant or New Membership in the menu system or from the Contact Summary form. Using the sign up pages that you Manage for the public leads to problems like this.
  
  
  ---
  
  