2

CiviCRM has a table called civicrm_subscription_history. This table stores a log of each time a contact is added, removed, or deleted from a group. That's cool. It seems to be reliable (tied in to the groupContact BAOs), and is even used with the role sync Drupal module too.

But, it doesn't seem to be 'used' anywhere? The information in the subscription history is never exposed to the front end? It seems to be just an ever-growing list of history that most users will never know exists.

The follow-up questions would be (if indeed it isn't exposed anywhere), should we:

  • Create a feature request to be able to turn the functionality on/off?
  • Create a feature request to expose it via a UI in core?
  • Create an extension that exposes it via a UI?
  • Copy out the code into an extension, with a UI that exposes it (and eventually deprecate it from core)?
  • Leave it alone? (Our table has 9 million rows though...)

It feels like a loose-end at the moment.

Edit: I notice it is exposed by the new GDPR extension from Veda Consulting.

2

The subscription history is shown in the Group tab of the Contact summary in as much as you can see Groups people 'were' in.

The the civicrm_group_contact table stores that people are 'removed' from the group, but the date that it happened is pulled from civicrm_subscription_history (as part of this function: \CRM_Contact_BAO_GroupContact::getContactGroup).

|improve this answer|||||
  • If you remove a contact from a group then it is still stored in the 'civicrm_group_contact' table. The status just changes from 'Added' to 'Removed'. I didn't think the tab was actually looking at the _subscription_history? – John Oct 10 '17 at 22:30
  • To confirm, here's the code that's looking in the group_contact table to get the people who have been 'removed': github.com/civicrm/civicrm-core/blob/… – John Oct 10 '17 at 22:36
1

civicrm_subscription_history is only minimally exposed in the core UI - but there is a Subscription History Report extension on my Github that you can use which exposes it to CiviReports.

|improve this answer|||||
0

It is used in as far as when you look at the Groups tab it is the source of data for the date field displayed.

|improve this answer|||||
  • As per my comment above, this actually seems to be stored in the group_contact table (along with normal group memberships). – John Oct 10 '17 at 22:37
  • Okay but Group Contact table doesn't have a date field. So on the Group Tab when you see eg Date Added - isn't that coming from this subs table? – petednz - fuzion Oct 11 '17 at 1:54
  • yes it is indeed pete! – ErikH - CiviCooP Oct 11 '17 at 6:26
  • Yes, that's right, found it in here: \CRM_Contact_BAO_GroupContact::getContactGroup Thanks – John Oct 11 '17 at 7:52
  • modified (as in totally changed) the answer to focus on the 'date' aspect in case it encourages you to tick or +1 it and keep SE happy so it doesn't keep bumping back up the list as 'doesn't have an accepted answer' – petednz - fuzion Oct 11 '17 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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