2

We are using CiviCRM with wordpress and we're trying to do a data cleanse to remove any out of date and spam contacts. None of the records we're trying to delete have financial data attached. We deleted over 500 records in batches using the permanently delete function and with each deletion the message appeared saying these records have been permanently deleted. At the time of deletion the total number of records reflected that these records had been deleted but the next day these records all reappear. Can anyone tell me how to resolve this please?

1
  • do you have any sort of script/job that is importing contacts from somewhere else? Are they exactly the same records (ie do an export of their name/email next time before you delete and then confirm that the new ones that appear are exact match)
    – petednz - fuzion
    Apr 1, 2021 at 20:10

2 Answers 2

4

I'm sharing this as I finally found a solution to the question I posted and hopefully it may help someone else who comes across a similar situation. Our organisation is membership based, so when a user sets up a record they are completing a Wordpress form, from which CiviCRM creates a Contact record. At the same time Wordpress creates a Profile which an administrator can access through Users in the menu options. When you look at a Contact record there is a field Contact ID / User ID and each is allocated a number, one of which is a blue link which takes you to the Profile record for that member. To delete a Contact record is very straightforward, but what I didn't realise is that before deleting the Contact record (CiviCRM), you need to delete the Profile record (Wordpress). The system is programmed to create a Contact record to match each Profile record, so if you only delete the Contact record it recreates the Contact record overnight. It's actually very straightforward but it's not covered in the User manual (at least not in the section that relates to deleting Contacts) and has taken me some time to resolve.

Please note, it may work differently for Drupal so it's worth checking if you are using a CMS other than Wordpress.

7
  • hmm. yes it is true that a CMS user is connected to a civi record (uf_match table), but i have never seen a situation where if you delete civi user, and do not delete the CMS user (in our case Drupal), that the Civi contact is recreated. maybe a WP scenario only. The Documentation is a community resource - if you feel able to offer an edit then it could help other WP users.
    – petednz - fuzion
    Oct 29, 2021 at 18:00
  • maybe a WP plugin 'does' something over night that reruns the civi record creation?
    – petednz - fuzion
    Oct 29, 2021 at 18:01
  • have raised over here chat.civicrm.org/civicrm/pl/gwcn61pdj7nk7g8cba7dw3zk5c
    – petednz - fuzion
    Oct 29, 2021 at 18:01
  • 1
    I've reproduced with just WP and Core CiviCRM. This is intended behavior (well as designed). Have contact linked to a CMS user. delete the contact, This should remove the uf_match entry. permanently deleted - no contact, no entry in uf_match. If the CMS user logins in again, CiviCRM creates a contact and adds to the uf_match table. So if you want the CMS user gone, you need to do that manually. The reasoning is the CMS user could have created content and we don't want to orphan content by deleting a contact. At least that is why I never looked at changing the behavior. Oct 29, 2021 at 18:29
  • Thanks for all your responses. Yes I'm happy to edit my comment to mention that it may work differently for Drupal. Interestingly it was a post on Google relating to Drupal that drew my attention to the solution.
    – Mary M
    Nov 1, 2021 at 13:26
1

Are those real contacts? Can you check the created date against the contact? It shows up at the bottom when you view the contact or you can grab from civicrm_contact.created_date using mysql.

If the dates are changing than it means those contact are created via Bots. Could check all the forms which are accessible to anonymous user have recaptcha installed these includes user registration, membership signup or event registration etc? Include recaptcha on all your Civi profile forms. Visit the permission page to check if anonymous user is allowed to create contact.

1
  • 1
    I've checked a handful of the contacts I know I had already deleted and yes the contacts are being created with a new date. My know how of the system is not sufficient to work out exactly how they're doing it but I've added captcha boxes on any profile forms where it was missing. I already updated the permission page to stop anonymous users creating contracts. I will see tomorrow morning if I've blocked all the possible avenues. Thank you I really appreciate your help.
    – Mary M
    Apr 1, 2021 at 15:36

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.