You are here

function messaging_user in Messaging 6.4

Same name and namespace in other branches
  1. 5 messaging.module \messaging_user()
  2. 6 messaging.module \messaging_user()
  3. 6.2 messaging.module \messaging_user()
  4. 6.3 messaging.module \messaging_user()

Implementation of hook_user().

Adds fieldset and default sending method setting.

File

./messaging.module, line 149

Code

function messaging_user($type, $edit, &$user, $category = NULL) {
  switch ($type) {
    case 'delete':

      // Delete user data from tables
      Messaging_Destination::delete_multiple(array(
        'uid' => $user->uid,
      ));
      messaging_store()
        ->delete_multiple(array(
        'uid' => $user->uid,
      ));
      break;
    case 'form':
      if ($category == 'account' && ($list = messaging_method_list($user))) {
        $form['messaging'] = array(
          '#type' => 'fieldset',
          '#title' => t('Messaging settings'),
          '#weight' => 5,
          '#collapsible' => TRUE,
        );
        $form['messaging']['messaging_default'] = array(
          '#type' => 'select',
          '#title' => t('Default send method'),
          '#default_value' => messaging_method_default($user),
          '#options' => $list,
          '#description' => t('Default sending method for getting messages from this system.'),
          '#disabled' => count($list) == 1,
        );
        return $form;
      }
      break;
  }
}