profile_field_delete

5 profile.module profile_field_delete($fid)
6 profile.admin.inc profile_field_delete(&$form_state, $fid)
7 profile.admin.inc profile_field_delete($form, &$form_state, $fid)

Menu callback; deletes a field from all user profiles.

1 string reference to 'profile_field_delete'

File

modules/profile/profile.module, line 371
Support for configurable user profiles.

Code

function profile_field_delete($fid) {
  $field = db_fetch_object(db_query("SELECT title FROM {profile_fields} WHERE fid = %d", $fid));
  if (!$field) {
    drupal_not_found();
    return;
  }
  $form['fid'] = array(
    '#type' => 'value',
    '#value' => $fid,
  );
  $form['title'] = array(
    '#type' => 'value',
    '#value' => $field->title,
  );

  return confirm_form($form, 
    t('Are you sure you want to delete the field %field?', array('%field' => $field->title)), 'admin/user/profile', 
    t('This action cannot be undone. If users have entered values into this field in their profile, these entries will also be deleted. If you want to keep the user-entered data, instead of deleting the field you may wish to <a href="@edit-field">edit this field</a> and change it to a hidden profile field so that it may only be accessed by administrators.', array('@edit-field' => url('admin/user/profile/edit/' . $fid))), 
    t('Delete'), t('Cancel'));
}
Login or register to post comments