function pcp_condition_check_profile_fields_completeness in Profile Complete Percent 6.2
Same name and namespace in other branches
- 5 pcp.module \pcp_condition_check_profile_fields_completeness()
Rules Condition - Are the selected user profile fields filed in?
Parameters
$user: The user for which the condition is checked.
$settings: The configured settings of the rule condition
Return value
TRUE or FALSE
See also
pcp_condition_check_profile_fields_completeness_form
pcp_rules_condition_info
1 string reference to 'pcp_condition_check_profile_fields_completeness'
- pcp_action_redirect_user_to_editform in ./
pcp.module - Rules Action - Redirect the user to his profile edit page
File
- ./
pcp.module, line 588 - 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_condition_check_profile_fields_completeness($user, $settings) {
$edit_categories = array();
profile_load_profile($user);
if ($settings['profile_fields']) {
$result = db_query("SELECT fid, title, name, category FROM {profile_fields} WHERE fid IN (%d)", implode(', ', $settings['profile_fields']));
while ($field = db_fetch_object($result)) {
if (!$user->{$field->name}) {
return FALSE;
}
}
}
return TRUE;
}