Closed (fixed)
Project:
Profile Complete Percent
Version:
7.x-1.2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Apr 2012 at 20:15 UTC
Updated:
12 May 2012 at 07:40 UTC
Hi,
I created a custom field called field_foo in the user profile, and checked it off in the PCP config panel. Then, I deleted the field from the user profile. As a result, I got the following error:
Notice: Undefined index: field_foo in pcp_get_complete_percentage_data() (line 191 of D:\web\condorproperties.ca\sites\all\modules\pcp\pcp.module).
I believe this is fixed by adding the following to line 254 of pcp.module in 7.x-1.2:
function pcp_get_tagged_profile_fields($fiid = NULL, $entity_type = NULL, $bundle = NULL) {
$query = db_select('field_config_instance', 'fci');
$query->addField('fci', 'id', 'fiid');
$query->addField('fci', 'field_name', 'field_name');
$query->join('profile_pcp', 'pcp', 'pcp.fiid = fci.id');
$query->condition('fci.deleted', 0, '='); // <---------------- FIX GOES HERE
if (isset($entity_type)) {
$query->condition('entity_type', $entity_type);
}
I would do this myself but I don't have faith in my ability to make useful contributions to Drupal.
Comments
Comment #0.0
Bogdan Balan commentedCode
Comment #0.1
Bogdan Balan commentedmore code
Comment #1
BarisW commentedThanks for reporting. Actually the problem here is that PCP doesn't clean up properly when a profile field gets deleted. Currently, it only checks for deleted Profile2 fields, not core fields. Your fixes removes the error, but not the underlying problem.
Anyhow, committed to .dev and gave you credits (http://drupal.org/user/1356740).
Comment #2.0
(not verified) commentedeven more code