How to disable the personal contact form option in the user edit form?

I am starting Drupal. When users create their account, they have the opportunity to have a personal contact form. Where can I turn this off? This is not in permissions. This is not a bad option, but I know that it will confuse the hell out of my site users. It might even scare you a little!

+5
source share
8 answers

If you visit admin / build / contact / settings in Drupal 6 or 5, you can disable the "Enable default personal contact form"

+3
source

Tested in Drupal 7.

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

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

, false, (), . , .

+6

, Drupal. , , , . , admin/build/settings.

, .

+2

Contact "Core - Optional". , "" .

Webform . . .

+2

Drupal 7

(D7) " /%/"

enter image description here

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;
    }
}

:

enter image description here

+2

Drupal 6:

, , , :

+1

, drupal, . , .

0

. :

" ", , , " ".

Simplify .

-1

All Articles