You are here

function user_relationship_mailer_user in User Relationships 6

Same name and namespace in other branches
  1. 5 plugins/user_relationship_mailer/user_relationship_mailer.module \user_relationship_mailer_user()
  2. 5.2 plugins/user_relationship_mailer/user_relationship_mailer.module \user_relationship_mailer_user()

hook_user()

File

user_relationship_mailer/user_relationship_mailer.module, line 189

Code

function user_relationship_mailer_user($type, &$edit, &$account, $category = NULL) {
  switch ($type) {
    case 'form':
      $form = array();
      if ($category == 'account') {

        // Note that we only need #access on the wrapper fieldset.
        $access = variable_get('user_relationship_mailer_send_mail', FALSE) && user_access('maintain own relationships', $account);
        $form['user_relationship_mailer_settings'] = array(
          '#type' => 'fieldset',
          '#title' => t('Relationship email settings'),
          '#weight' => 5,
          '#access' => $access,
        );
        $form['user_relationship_mailer_settings']['user_relationship_mailer_send_mail'] = array(
          '#type' => 'checkbox',
          '#title' => t('Receive relationship email notifications'),
          '#default_value' => isset($edit['user_relationship_mailer_send_mail']) ? $edit['user_relationship_mailer_send_mail'] : TRUE,
          '#description' => t("Check this if you'd like to receive relationship related email notifications"),
        );
      }
      return $form;
  }
}