function pcp_get_tagged_profile_fields in Profile Complete Percent 6.2
Same name and namespace in other branches
- 5 pcp.module \pcp_get_tagged_profile_fields()
- 6 pcp.module \pcp_get_tagged_profile_fields()
- 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_get_complete_percentage_data in ./
pcp.module - Get the profile complete percentage data for a given user.
- _pcp_field_is_tagged in ./
pcp.module - Check if a profile field is tagged as to be filled in. Returns TRUE or FALSE
File
- ./
pcp.module, line 408 - 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) {
$profile_role_used = module_exists('profile_role');
if ($fid > 0) {
$query = db_query("SELECT * FROM {profile_pcp} LEFT JOIN {profile_fields} USING(fid) WHERE fid = %d", $fid);
}
else {
$query = db_query("SELECT * FROM {profile_pcp} LEFT JOIN {profile_fields} USING(fid)");
}
$fields = array();
while ($result = db_fetch_array($query)) {
if ($profile_role_used) {
global $user;
if (profile_role_access_category($user, $result['category'])) {
$fields[] = $result;
}
}
else {
$fields[] = $result;
}
}
return $fields;
}