Same name and namespace in other branches
  1. 4.6.x modules/blog.module \blog_user()
  2. 4.7.x modules/blog.module \blog_user()
  3. 5.x modules/blog/blog.module \blog_user()

Implementation of hook_user().

File

modules/blog/blog.module, line 46
Enables keeping an easily and regularly updated web page or a blog.

Code

function blog_user($type, &$edit, &$user) {
  if ($type == 'view' && user_access('create blog entries', $user)) {
    $user->content['summary']['blog'] = array(
      '#type' => 'user_profile_item',
      '#title' => t('Blog'),
      // l() escapes the attributes, so we should not escape !username here.
      '#value' => l(t('View recent blog entries'), "blog/{$user->uid}", array(
        'attributes' => array(
          'title' => t("Read !username's latest blog entries.", array(
            '!username' => $user->name,
          )),
        ),
      )),
      '#attributes' => array(
        'class' => 'blog',
      ),
    );
  }
}