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

Bogdan Balan’s picture

Issue summary: View changes

Code

Bogdan Balan’s picture

Issue summary: View changes

more code

BarisW’s picture

Status: Active » Fixed

Thanks 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).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

even more code