I have a WordPress website with large CiviCRM database. For some reason, CiviCRM is reading one of my Administrators as a contact name (not matching his name) and every time I try to delete him and make him a new user, it matches him to another contact (not his). How can I find a fix for this issue?
Every WordPress (or other CMS) user gets a CiviCRM contact, even though not every contact corresponds to a user. The only tool CiviCRM has for making these matches is the email address. Once CiviCRM is installed, whenever a new WordPress user is added, CiviCRM will find or create an individual contact with that email address.
If you have a lot of contacts with this person's email address and/or if his contact has a different email address, you may run into issues. You also may have another user already connected to his contact record. Pete's suggestion about the
civicrm_uf_match table is a good one: that's the table that connects the user to the contact.
Assuming you have a user account that is good and a contact that is good (and an Individual, not a Household or Organization), you can use the API Explorer to fix the problem.
Get the IDs of the WordPress user and the CiviCRM contact you want to connect. Also, get the email address that is on the WordPress user record.
Go to Support > Developer > API Explorer
For Entity, pick
UFMatchand for Action, pick
In the Parameter drop-down, pick
CiviCRM Contact ID, leave the operator as
=, and in the Value field, enter the Contact ID.
Click Chain API Call, and in the line the appears, select
UFMatchas the Entity and
deletein the second column, and leave the third column as
Hit Execute. This will delete any records connecting the good contact to any WordPress user.
Now, modify the first parameter and change it to
CMS ID, leave the
=, and change the value to the WordPress user ID of the user you want to connect.
Hit Execute. This will delete any records connecting the good user to any CiviCRM contact.
Now, go to the Action drop-down and select
create. This should clear out the old parameters and set up three for CMS ID, CMS Unique Identifier, and CiviCRM Contact ID.
Fill those values: enter the WordPress user ID as CMS ID, the WordPress user's email address as the CMS Unique Identifier, and enter the CiviCRM contact ID as CiviCRM Contact ID.
Hit Execute. This will explicitly connect the WordPress user to the CiviCRM contact. You can verify this by going to the contact record and seeing the user ID there next to the contact ID.