I need to rebuild some groups where all the members were removed by the link between CiviCRM and Mailchimp. I have found the ability to list all members of a group who have ever been removed from that group, but I also need to be able to filter this by the date they were removed. Is there any way to search for members of a group who were removed on a specific date?
3 Answers
I'm not sure if this functionality exists from the UI or API. I think it's not.
A quick recall says that this info is being stored in civicrm_subscription_history
table where contact_id
, group_id
, status(Added or Removed)
and date
(the one when the action was triggered) can be viewed.
I have an extension that provides a custom report Subscription History that does this.
For info, the GDPR extension (first released March 2018) includes a "Search Group Subscription by Date Range" custom search i.e. you can select a group, a group status and importantly a date criteria.
If the rest of the GDPR extension functionality isn't needed, and you're keen and able, the relevant sections of code could be used as a basis to make your own custom search extension.
Or adding to jitendra's answer, output the contact IDs with something like this database query:
SELECT * FROM civicrm_subscription_history WHERE group_id = ? AND status = "Removed" AND date > "????-??-?? ??:??:??";
As required, these could then be output as CSV e.g. using phpMyAdmin and then added to a group(s) via Import Contacts.