You are here

function pcp_get_additional_tagged_fields in Profile Complete Percent 6.2

Same name and namespace in other branches
  1. 7 pcp.module \pcp_get_additional_tagged_fields()

Get all additional tagged fields that where not created using the profile module. This allows additional PCP support for other drupal features.

1 call to pcp_get_additional_tagged_fields()
pcp_get_complete_percentage_data in ./pcp.module
Get the profile complete percentage data for a given user.

File

./pcp.module, line 452
Allows users with valid permissions to tag profile fields created from the profile module as required fields for a users profile to be considered complete.

Code

function pcp_get_additional_tagged_fields() {
  $fields = array();

  // Enable user picture support.
  if (variable_get('pcp_enable_user_picture', 0) && variable_get('user_pictures', 0)) {
    $fields['user_picture'] = array(
      'fid' => 'user_picture',
      'title' => 'User Picture',
      'name' => 'picture_upload',
    );
  }
  if (module_exists('user_terms')) {
    $vocabs = taxonomy_get_vocabularies();
    $user_terms_vocabs = variable_get('pcp_enabled_user_terms_vocabs', array());
    $vocabs_path = variable_get('user_terms_vocabs_path', array());
    $all_vocabs = array();
    foreach ($user_terms_vocabs as $vid) {
      $all_vocabs[$vid] = $vocabs[$vid]->name;
    }
    foreach ($all_vocabs as $vid => $name) {
      $fields['user_terms_' . $vid] = array(
        'fid' => 'user_terms_' . $vid,
        'title' => $name,
        'name' => 'user_terms_' . $vid,
        'category' => $vocabs_path[$vid],
      );
    }
  }
  return $fields;
}