function user_user in Drupal 6
Same name and namespace in other branches
- 4 modules/user.module \user_user()
- 5 modules/user/user.module \user_user()
Implementation of hook_user().
File
- modules/
user/ user.module, line 643 - 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') {
if ($category == 'account') {
return _user_edit_submit(isset($account->uid) ? $account->uid : FALSE, $edit);
}
elseif (isset($edit['roles'])) {
// Filter out roles with empty values to avoid granting extra roles when
// processing custom form submissions.
$edit['roles'] = array_filter($edit['roles']);
}
}
if ($type == 'categories') {
return array(
array(
'name' => 'account',
'title' => t('Account settings'),
'weight' => 1,
),
);
}
}