You are here

function profile2_page_delete_confirm_form in Profile 2 7.2

Same name and namespace in other branches
  1. 7 contrib/profile2_page.inc \profile2_page_delete_confirm_form()

Confirm form for deleting a profile.

1 string reference to 'profile2_page_delete_confirm_form'
profile2_page_menu in contrib/profile2_page.module
Implements hook_menu().

File

contrib/profile2_page.inc, line 130
Adds separate pages for viewing and editing profiles.

Code

function profile2_page_delete_confirm_form($form, &$form_state, $profile) {
  global $user;
  $form_state += array(
    'profile2' => $profile,
  );
  $type = profile2_get_types($profile->type);
  if (isset($profile->uid) && $profile->uid === $user->uid) {
    $confirm_question = t('Are you sure you want to delete your own %label profile ?', array(
      '%label' => $type
        ->getTranslation('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' => $type
          ->getTranslation('label'),
        '%user' => $user_account->name,
      ));
    }
  }
  return confirm_form($form, $confirm_question, $profile
    ->path());
}