mysite_delete_form

Definition

mysite_delete_form($uid)
mysite.module, line 2291

Description

FormsAPI for deleting a user's entire collection.

Code

function mysite_delete_form($uid) {
  global $user;
  $mysite = mysite_get($uid);
  if ($mysite->uid) {
    $form = array();
    // If this is not the user, print a message for the admin.
    if ($mysite-> uid != $user->uid) {
      $form = confirm_form($form, t('Are you sure you wish to delete this user page?'), "mysite/$uid",
            t('<p>%user may be able to recreate the page if he or she has the "edit mysite" permission.</p>', array('%user' => $mysite->name)),
            t('Delete this collection'), t('Cancel'), 'mysite_delete_form');
    }
    else {
      $form = confirm_form($form, t('Delete your personal pages?'), "mysite/$uid",
            t('<p>%user, are you sure you wish to delete your personal pages?  You may recreate them later if you wish.</p>', array('%user' => $mysite->name)),
            t('Delete my collection'), t('Cancel'), 'mysite_delete_form');
    }
    $form['uid'] = array('#type' => 'value', '#value' => $uid);
    return $form;
  }
  else {
    drupal_set_message(t('This user does not have a personal page.'));
    drupal_goto('mysite');
  }
}