Skip to main content

CiviCRM custom data storage

I'm thinking about customizing CiviCRM such that custom data can be linked to Personal Campaign Pages. Here are some notes on how the database is set up:

Upon creating a new Custom Data Group, a new table is created called civicrm_value_[group_name]_[group_id] in which the data for this new group will be stored. Columns in this table are id, entity_id (i.e., the id of the user if this data is to be linked to a user), and custom columns for each of the new custom data fields in this group. A new record is also created in the civicrm_custom_group table.

I imagine that it should be possible to extend the Personal Campaign Pages system such that they can be extended using a custom data group, and the fields in this group are presented when creating or editing a new PCP. I think that this would be the best way to handle this.

ALTERNATELY, since events can already have new custom data groups associated with them, it may be that we want to link all PCP's with events and store this custom data on the event record rather than the PCP record. Whether we do this depends on whether it's practical to associate all PCP's with events, or just the ones that will actually have dates associated with them. A start date is required, though an end date is optional; these could easily be used as the dates when the page should be live (or even just be defaulted to the current date/time).