function pcp_update_7002 in Profile Complete Percent 7
Update the fields to use machine names.
File
- ./
pcp.install, line 64 - Install file for the pcp module.
Code
function pcp_update_7002() {
$enabled_fields = variable_get('pcp_enabled_fields', array());
$query = db_select('field_config_instance', 'fci');
$query
->addField('fci', 'field_name', 'field_name');
$query
->addField('fci', 'bundle', 'bundle');
$query
->addField('fci', 'entity_type', 'entity_type');
$query
->condition('fci.deleted', 0);
$query
->condition('fci.entity_type', array(
'user',
'profile2',
), 'IN');
$query
->condition('fci.id', array_values($enabled_fields), 'IN');
$result = $query
->execute();
$fields = array();
foreach ($result as $row) {
$field_identifier = $row->entity_type . ':' . $row->bundle . ':' . $row->field_name;
$fields[$field_identifier] = $field_identifier;
}
variable_set('pcp_enabled_fields', $fields);
}