You are here

function _pcp_disable_field in Profile Complete Percent 7

3 calls to _pcp_disable_field()
pcp_admin_settings_submit in includes/pcp.admin.inc
Submit callback.
pcp_delete_field_requireness in ./pcp.module
Called when a user deletes a profile field We then need to delete the pcp value too
_pcp_save_profile_fields in includes/pcp.admin.inc
Utility function used to save fields.

File

./pcp.module, line 573
Allows users with valid permissions to tag profile fields (core fields or Profile2 fields) for a users profile to be considered complete.

Code

function _pcp_disable_field($entity_type, $bundle, $field_name) {
  $enabled_fields = variable_get('pcp_enabled_fields', array());
  $field_identifier = implode(':', array(
    $entity_type,
    $bundle,
    $field_name,
  ));
  if (in_array($field_identifier, $enabled_fields)) {
    $key = array_search($field_identifier, $enabled_fields);
    unset($enabled_fields[$field_identifier]);
    variable_set('pcp_enabled_fields', $enabled_fields);
    return TRUE;
  }
  return FALSE;
}