0

Wordpress 6.4.2, CiviCRM 5.69.2 Have got the "You have multiple records with the same uf_id in civicrm_uf_match. You need to manually fix this in the database so that uf_id is unique" but the "Learn More" link (https://docs.civicrm.org/sysadmin/en/latest/upgrade/todo/#todo) leads to a non-existing page.

There are duplicates indeed ( checked using the query below ). But what is the best course of action here?

SELECT uf_id, COUNT(*) AS record_count
FROM civicrm_uf_match
GROUP BY uf_id
HAVING COUNT(*) > 1;
4
  • Seeing this in the latest ESR. We're looking into it and will report back with a, hopefully helpful, answer.
    – Darren
    Jan 24 at 16:13
  • There is the "CiviCRM WordPress Member Sync" ( github.com/christianwach/civicrm-wp-member-sync ) installed and configured, is it possible there is something not quite right with it?
    – yurg
    Jan 24 at 16:27
  • 1
    We are on Drupal 10 so it's defo data related. We do have member sync installed installed. There is an issue here which could be related: lab.civicrm.org/dev/core/-/issues/4500
    – Darren
    Jan 24 at 17:11
  • @Darren I think this comment deserves to be the answer. And the answer with SQL code piece is perfect as useful comment ;-)
    – yurg
    Jan 25 at 11:00

2 Answers 2

1

The following SQL will show you the offending records:-

SELECT * FROM www_civicrm.civicrm_uf_match
where uf_id in 
(SELECT uf_id FROM www_civicrm.civicrm_uf_match
group by uf_id
having count(*)>1)

This should give a list such as:-

id, domain_id, uf_id, uf_name, contact_id, language
'667', '1', '180', '[email protected]', '1234', NULL
'668', '1', '182', '[email protected]', '1235', NULL
'669', '1', '180', '[email protected]', '1236', NULL
'670', '1', '182', '[email protected]', '1237', NULL

So in this case we looked at the User and Contact records (using the Email and Contact ID) to find which one had logged in recently, or made a contribution, event reg, etc.... and removed the ones with older records.

Another option is to update this table with the correct UF_ID and ContactID if the records are valid.

Please backup your DB when deleting the offending records via SQL.

1

I think the big question is going to be how you got duplicate uf_ids and how to prevent it from happening. How many duplicates are you seeing? The only fix I can think of is to manually remove the duplicates, but manual database changes can be a little risky. If there are just a few of them, then try to identify the "right" one, and delete the other one. If there are loads of them, I'd say look for a pattern and go from there. In any case, it will probably need to be a manual database fix. Sorry this is sort of a vague answer!

1

Your Answer

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

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