How do I disable the personal contact form option in the user edit form?

7.2k Views Asked by At

I am a Drupal beginner. When users create their account, they have the option to have a personal contact form. Where do I go to disable that? It's not in permissions. It's not a bad option, but I know it will confuse the hell out of my site's users. It may even scare some away!

8

There are 8 best solutions below

0
On BEST ANSWER

If you visit admin/build/contact/settings in Drupal 6 or 5 you can untick "Enable personal contact form by default"

1
On

Drupal 7

All answers NOT remove the section for personal contact option displayed (D7) at "user/%/edit"

enter image description here

For remove tab AND settings for Drupal 7:

/**
 * Implements hook_form_alter().
 */
function MY_MODULE_form_alter(&$form, &$form_state, $form_id) {
  if ('user_profile_form' === $form_id) {
     $form['contact']['#access'] = FALSE;
  }
}

/**
 * Implements hook_preprocess_page().
 */
function MY_MODULE_preprocess_page(&$variables) {
    $menu_items = menu_get_item();
    if('user/%/edit' === $menu_items['path']){
         $variables['page']['content']['content']['content']['system_main']['contact']['#access'] = FALSE;
    }
}

After:

enter image description here

0
On

Use Contact permissions. It provides a permission:

"Have a personal contact form" which allows administrators to configure which roles get the ability to have a "Personal contact form".

Also the Simplify module has a separate option for that.

0
On

A personal contact form is not something you get by default in Drupal. There are modules that can do this, you have probably activated such a module. Check what modules you have activated at admin/build/settings.

If you want to disable this for regular users only you should instead check you permission settings.

0
On

Either check what modules you have set on drupal, or check the settings for contact forms. I believe it has the option for site wide contact form and user contact form.

0
On

Disable the Contact module under 'Core - Optional'. Look through user permissions for anything related to 'contact' and uncheck it.

Personally recommend Webform to handle site wide contact forms. It will let you construct your form with a UI. Easiest way to get a Contact Us page.

1
On

Drupal 6:

If you want to have the site-wide contact form enabled, but not even display the option for a personal contact form to your users you must follow these steps:

  1. Create a custom module

    http://www.hankpalan.com/blog/drupal/make-custom-drupal-module

  2. Add this code to your .module file:

    function your_module_name_form_user_profile_form_alter(&$form, &$form_state) {

    unset ($form['contact']);

    }

0
On

Tested in Drupal 7.

Place the following in template.php of your theme. Change MYTHEME to your theme name.

function MYTHEME_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'user_profile_form') {
    $form['contact']['#access'] = FALSE;
  }
}

Notice that access is set to false, instead of being unset(), i.e. removed. That way we're not interfering with the flow of data.