Answers.Body: <p>When you create a User the user email, civicrm email and uf_match table are all the same.</p>
  
  <p>If you then edit the civicrm email, the uf_match gets updated as does the User email.</p>
  
  <p>If you edit the user email, the uf_match is updated, as is the civicrm email.</p>
  
  <p>BUT I don't think this has always been the case. I can't track when the new feature came in to 4.6.x but I have a strong memory that in the past these were not always kept in synch but can't recall whether it was editing the user email or the civicrm email that would result in only the uf_match being updated but not the 'other end' of the pipe.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-01T07:57:15.120Z
Answers.Text: Thank you Pete for your answer, but I made some tests a few days ago : when you modify the Contact email, the User email is modified accordingly, but when you modify the User email, the Contact email does not follow (I don't know about the uf_match uf_name).
Answers.UserDisplayName: Jacques-Marie Moranne
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-01T19:40:28.747Z
Answers.Text: Hmm - and I see you are on 4.7.12. Well your outcome is what I expected but I tested on a site and  reported what I observed. Jacques if you can fire me your email via https://www.fuzion.co.nz/contact I will send you a screencast
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-30T19:51:26.027Z
Answers.LastActivityDate: 2016-11-30T19:51:26.027Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>There is a function that synchronizes users and contacts (/civicrm/admin/synchUser?reset=1). Not sure if this would help in any case I recommend trying it on a testing environment first. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-01T08:24:26.157Z
Answers.Text: Thank you Fabian ; I knew this command, but did not dare using it. But I did now, which re-established the link (my civicrm_uf_table contains 442 lines now. But I have a few duplicates (both contacts and users (with same email)) that I must merge now. Thanks again.
Answers.UserDisplayName: Jacques-Marie Moranne
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-30T16:56:38.583Z
Answers.LastActivityDate: 2016-11-30T16:56:38.583Z
Answers.UserDisplayName: Fabian
Answers.Body: <p>The <code>civicrm_uf_match</code> table is the correct place to look.  I can't explain why you're seeing what you're seeing!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-01T08:07:49.913Z
Answers.Text: Thank you Jon for your answer : I have to trust you : I made some cleaning in my DB some weeks ago (via standard commands, not directly in the tables), because I had fed it by means of successive imports which were not clean ; and I may have lost some connexions at that time. When I cleaned it, I just kept those Users with same Contact email.  BTW, I will follow. Thanks again.
Answers.UserDisplayName: Jacques-Marie Moranne
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-01T08:24:22.420Z
Answers.Text: See also my comment to Fabian
Answers.UserDisplayName: Jacques-Marie Moranne
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-30T16:35:18.843Z
Answers.LastActivityDate: 2016-11-30T16:35:18.843Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I am in Drupal 7.51 / CiviCRM 4.7.12</p>
  
  <p>I want to check Users emails against their corresponding Contacts emails (which happen to be different in the DB though they should not).</p>
  
  <p>I have developped a small program to identify those cases (querying civicrm_email and drupal_users tables, linked via civicrm_uf_match).</p>
  
  <p>I thought that the civicrm_uf_match table managed the link between the Drupal User id and the corresponding Civicrm Contact id ; but it actually does not : it contains only 31 lines though I have 446 Users and 667 Contacts with a primary email.</p>
  
  <p>For instance, the civicrm_uf_match table does not contain my own ids pair ; moreover, it contains lots of errors (e.g. old emails which were deleted).</p>
  
  <p>Question : how and where is managed this link between the Drupal User and the CiviCRM Contact (which appears when you consult/modify the Contact) ?</p>
  
Tags: <core>
Title: Checking Inconsistencies between Users and Contacts Emails (via civicrm_uf_match table ?)
ThreadText: # Checking Inconsistencies between Users and Contacts Emails (via civicrm_uf_match table ?)
  
  (Asked by: username_0 on 2016-11-30)
  
  I am in Drupal 7.51 / CiviCRM 4.7.12
  
  I want to check Users emails against their corresponding Contacts emails (which happen to be different in the DB though they should not).
  
  I have developped a small program to identify those cases (querying civicrm\_email and drupal\_users tables, linked via civicrm\_uf\_match).
  
  I thought that the civicrm\_uf\_match table managed the link between the Drupal User id and the corresponding Civicrm Contact id ; but it actually does not : it contains only 31 lines though I have 446 Users and 667 Contacts with a primary email.
  
  For instance, the civicrm\_uf\_match table does not contain my own ids pair ; moreover, it contains lots of errors (e.g. old emails which were deleted).
  
  Question : how and where is managed this link between the Drupal User and the CiviCRM Contact (which appears when you consult/modify the Contact) ?
  
  **Tags:** core
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2016-11-30. Score: 2
  
  When you create a User the user email, civicrm email and uf\_match table are all the same.
  
  If you then edit the civicrm email, the uf\_match gets updated as does the User email.
  
  If you edit the user email, the uf\_match is updated, as is the civicrm email.
  
  BUT I don't think this has always been the case. I can't track when the new feature came in to 4.6.x but I have a strong memory that in the past these were not always kept in synch but can't recall whether it was editing the user email or the civicrm email that would result in only the uf\_match being updated but not the 'other end' of the pipe.
  
  > **Comments:**
  > **username_0**: Thank you Pete for your answer, but I made some tests a few days ago : when you modify the Contact email, the User email is modified accordingly, but when you modify the User email, the Contact email does not follow (I don't know about the uf_match uf_name).  
  > **username_1**: Hmm - and I see you are on 4.7.12. Well your outcome is what I expected but I tested on a site and  reported what I observed. Jacques if you can fire me your email via https://www.fuzion.co.nz/contact I will send you a screencast  
  
  ---
  
  ### Answer by username_2 on 2016-11-30. Score: 2
  
  There is a function that synchronizes users and contacts (/civicrm/admin/synchUser?reset=1). Not sure if this would help in any case I recommend trying it on a testing environment first.
  
  > **Comments:**
  > **username_0**: Thank you username_2 ; I knew this command, but did not dare using it. But I did now, which re-established the link (my civicrm_uf_table contains 442 lines now. But I have a few duplicates (both contacts and users (with same email)) that I must merge now. Thanks again.  
  
  ---
  
  ### Answer by username_3 on 2016-11-30. Score: 2
  
  The `civicrm_uf_match` table is the correct place to look. I can't explain why you're seeing what you're seeing!
  
  > **Comments:**
  > **username_0**: Thank you Jon for your answer : I have to trust you : I made some cleaning in my DB some weeks ago (via standard commands, not directly in the tables), because I had fed it by means of successive imports which were not clean ; and I may have lost some connexions at that time. When I cleaned it, I just kept those Users with same Contact email.  BTW, I will follow. Thanks again.  
  > **username_0**: See also my comment to username_2  
  
  ---
  
  