2

I am migrating my CiviCRM database to a new server with a fresh install of Wordpress and CiviCRM. I would like to know where in the database the link between CiviCRM contacts and Wordpress Users are, so if needs be I can manually correct them (there are not many contacts linked to users in my database).

Maybe Civi will correct the link between users and contacts if I were to use the 'Synchronize Users to Contacts' feature again in the new system, does anyone have experience of this?

Regardless I would be interested to know about where this link is stored to improve my familiarity with how Civi works. I looked in the civi_contact table but could not see any field there that might store the linked user id from Wordpress.

6

Great question!

The matching between the CMS user and the CiviCRM contacts relies, like most "relationships" between entities in CiviCRM, on an additional table that maps the IDs between the two entity types.

For the Contact to CMS User match you're looking for the civicrm_uf_match table. This table has the following columns:

  • ID - this is the Unique ID of the match record.
  • DOMAIN_ID - this is the Unique ID of the CiviCRM domain in a multisite setup.
  • UF_ID - this is the User's ID in the "UserFramework (UF)" (this is what CiviCRM calls the CMS).
  • UF_NAME - this is the User's Username or Email address in the UserFramework.
  • CONTACT_ID - this is the Unique ID of the CiviCRM contact that matches to the User.

Hope this helps!

1
  • I accepted this answer as although it was a couple of minutes later, I assume they were writing your answer which had a bit more detail in. I would have accepted both answers if I could, but I gave them both an upvote. Thanks for the quick response from you both!
    – dading84
    Apr 7 at 10:57
4

In the civicrm_uf_match mysql table

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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