user_user

5 user.module user_user($type, &$edit, &$user, $category = NULL)
6 user.module user_user($type, &$edit, &$account, $category = NULL)

Implementation of hook_user().

File

modules/user/user.module, line 632
Enables the user registration and login system.

Code

function user_user($type, &$edit, &$account, $category = NULL) {
  if ($type == 'view') {
    $account->content['user_picture'] = array(
      '#value' => theme('user_picture', $account), 
      '#weight' => -10,
    );
    if (!isset($account->content['summary'])) {
      $account->content['summary'] = array();
    }
    $account->content['summary'] += array(
      '#type' => 'user_profile_category', 
      '#attributes' => array('class' => 'user-member'), 
      '#weight' => 5, 
      '#title' => t('History'),
    );
    $account->content['summary']['member_for'] = array(
      '#type' => 'user_profile_item', 
      '#title' => t('Member for'), 
      '#value' => format_interval(time() - $account->created),
    );
  }
  if ($type == 'form' && $category == 'account') {
    $form_state = array();
    return user_edit_form($form_state, (isset($account->uid) ? $account->uid : FALSE), $edit);
  }

  if ($type == 'validate' && $category == 'account') {
    return _user_edit_validate((isset($account->uid) ? $account->uid : FALSE), $edit);
  }

  if ($type == 'submit' && $category == 'account') {
    return _user_edit_submit((isset($account->uid) ? $account->uid : FALSE), $edit);
  }

  if ($type == 'categories') {
    return array(array('name' => 'account', 'title' => t('Account settings'), 'weight' => 1));
  }
}
Login or register to post comments