5

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!

2
  • 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 civicrm.stackexchange.com/questions/19/….
    – P a u l
    Mar 30, 2015 at 19:03
  • 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.
    – DenisH
    Apr 11, 2015 at 7:02

3 Answers 3

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.

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.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.