You are here

function sharedemail_subuser_form_user_profile_form_alter in Shared Email 6

Implementation of hook_form_alter(). Altering the user_edit_form.

File

modules/sharedemail_subuser/sharedemail_subuser.module, line 29
Integrate Subuser and Shared Email modules.

Code

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

  // If the current user is the one being edited, and it has a parent, deny mail edit access.
  if ($GLOBALS['user']->uid == $form['#uid']) {
    $form['account']['mail']['#access'] = !(bool) subuser_get_parent($form['#uid']);
  }
  if (subuser_get_subusers($form['#uid'])) {
    $form['account']['pass']['#weight'] = 1;
    $form['account']['status']['#weight'] = 2;
    $form['account']['sharedemail_mail_sync'] = array(
      '#type' => 'checkbox',
      '#title' => t('Sync email to subusers'),
      '#description' => t('This email address will be used for all of it\'s subuser accounts.'),
      '#default_value' => FALSE,
    );
  }
}