function template_preprocess_pcp_template in Profile Complete Percent 7
Process variables for pcp-template.tpl.php.
See also
File
- ./
pcp.module, line 549 - Allows users with valid permissions to tag profile fields (core fields or Profile2 fields) for a users profile to be considered complete.
Code
function template_preprocess_pcp_template(&$variables) {
if (isset($variables['nextfield_name'])) {
// Generate URL to edit next field for core user profile.
if ($variables['entity_type'] == 'user') {
$input_name = 'edit-' . str_replace('_', '-', $variables['nextfield_name']);
$user_edit_path = 'user/' . $variables['uid'] . '/edit';
$variables['next_path'] = url($user_edit_path, array(
'absolute' => TRUE,
'fragment' => $input_name,
));
}
elseif ($variables['entity_type'] == 'profile2') {
$bundle = $variables['bundle'];
$input_name = 'edit-profile-' . str_replace('_', '-', $bundle) . '-' . str_replace('_', '-', $variables['nextfield_name']);
// Determine correct 'edit path' for profile2 profile type.
$old_profile_edit_path = 'profile-' . $bundle . '/' . $variables['uid'] . '/edit';
$new_profile_edit_path = 'user/' . $variables['uid'] . '/edit/' . $bundle;
$profile_edit_path = drupal_valid_path($old_profile_edit_path) ? $old_profile_edit_path : $new_profile_edit_path;
$variables['next_path'] = url($profile_edit_path, array(
'absolute' => TRUE,
'fragment' => $input_name,
));
}
}
}