function profile2_usermerge_account_properties in User Merge 7.2
Implements hook_usermerge_account_properties().
File
- includes/
profile2.usermerge.inc, line 20 - Adds support for Profile 2. Supplemental include loaded via usermerge_load_includes().
Code
function profile2_usermerge_account_properties($user_to_delete, $user_to_keep, $action) {
// Set the account properties.
$account_properties = array();
// Retrieve all bundles for the profile.
$bundles = field_info_bundles('profile2');
// Set the profile fields as properties.
foreach ($bundles as $bundle => $bundle_info) {
// Set the bundle information.
$account_properties[$bundle] = array(
'title' => t('Profile - @label', array(
'@label' => $bundle_info['label'],
)),
'type' => $bundle,
'items' => array(),
);
// Add all fields from that bundle.
foreach (field_info_instances('profile2', $bundle) as $name => $info) {
$field_info = field_info_field($name);
$item = array(
'label' => str_replace(':', '', $info['label']),
'cardinality' => $field_info['cardinality'],
);
// Set the item.
$account_properties[$bundle]['items'][$name] = $item;
}
}
return array(
'profile2' => $account_properties,
);
}