function profile2_delete_confirm_form in Profile 2 7
Same name and namespace in other branches
- 7.2 profile2.delete.inc \profile2_delete_confirm_form()
Confirm form for deleting own profile.
1 string reference to 'profile2_delete_confirm_form'
- profile2_menu in ./
profile2.module - Implements hook_menu().
File
- ./
profile2.delete.inc, line 11 - Contains functions for Profile Delete.
Code
function profile2_delete_confirm_form($form, &$form_state, $profile) {
global $user;
if (isset($profile) && is_object($profile)) {
$form_state += array(
'profile2' => $profile,
);
if ($user->uid === $profile->uid) {
$confirm_question = t('Are you sure you want to delete your own %label profile ?', array(
'%label' => $profile->label,
));
}
elseif (user_access('administer profiles')) {
$user_account = user_load($profile->uid);
if (!empty($user_account)) {
$confirm_question = t("Are you sure you want to delete profile %label of user %user?", array(
'%label' => $profile->label,
'%user' => $user_account->name,
));
}
}
return confirm_form($form, $confirm_question, 'user/' . $profile->uid);
}
}