Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Apress.Pro.Drupal.7.Development.3rd.Edition.Dec.2010.pdf
Скачиваний:
65
Добавлен:
14.03.2016
Размер:
12.64 Mб
Скачать

CHAPTER 6 WORKING WITH USERS

// update the user page by adding the number of logins to the page $build['summary']['login_history'] = array(

'#type' => 'user_profile_item', '#title' => t('Number of logins'), '#markup' => $login_count, '#weight' => 10,

);

}

After installing this module, each successful user login will fire the login operation of the hook_user_login, which the module will respond to by inserting a record into the login_history table in the database. When the $user object is loaded during hook_user_view, the hook_user_view_alter function will be fired, and the module will add the current number of logins for that user to the page when the user views the “My account” page, as shown in Figure 6-4.

Figure 6-4. Login history tracking user logins

Providing User Information Categories

If you have an account on http://drupal.org, you can see the effects of providing categories of user information by logging in and clicking the “My account” link, and then selecting the Edit tab. In addition to editing your account information, such as your password, you can provide information about yourself in several other categories such as Drupal involvement, personal information, work information, and preferences for receiving newsletters.

129

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]