You are here

function pcp_get_tagged_profile_fields in Profile Complete Percent 5

Same name and namespace in other branches
  1. 6.2 pcp.module \pcp_get_tagged_profile_fields()
  2. 6 pcp.module \pcp_get_tagged_profile_fields()
  3. 7 pcp.module \pcp_get_tagged_profile_fields()

Get all the profile fields that have been tagged. If an $fid is passed in, only the data for that field will be returned.

Parameters

int $fid - The fid of the field data should be returned for. If 0, all fields are returned.:

Return value

indexed array - All fields and their information returned from the query.

3 calls to pcp_get_tagged_profile_fields()
pcp_admin_settings_form_data in ./pcp.module
Function that sets up parameters to be used when the pcp_admin_settings_form() function is executed.
pcp_form_alter in ./pcp.module
Implementation of hook_form_alter()
pcp_get_complete_percentage_data in ./pcp.module
Get the profile complete percentage data for a given user.

File

./pcp.module, line 265
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_tagged_profile_fields($fid = 0) {
  $where = '';
  $args = '';
  if ($fid > 0) {
    $where = " WHERE fid = %d";
    $args = array(
      $fid,
    );
  }
  $query = db_query("SELECT * FROM {profile_pcp} LEFT JOIN {profile_fields} USING(fid) {$where}", $args);
  $fields = array();
  while ($result = db_fetch_array($query)) {
    $fields[] = $result;
  }
  return $fields;
}