You are here

function guestbook_user_view in Guestbook 7.2

Implements hook_user_view().

File

./guestbook.module, line 92

Code

function guestbook_user_view($account, $view_mode, $langcode) {
  $guestbook_mode = variable_get('guestbook_mode', GUESTBOOK_SITE_GUESTBOOK | GUESTBOOK_USER_GUESTBOOKS);
  if ($guestbook_mode & GUESTBOOK_USER_GUESTBOOKS) {
    if (user_access('access user guestbooks') && empty($account->data['guestbook_status'])) {
      $title = t("Read @username's guestbook.", array(
        '@username' => $account->name,
      ));
      $link = l(t('View recent guestbook entries'), "user/{$account->uid}/guestbook", array(
        'attributes' => array(
          'title' => $title,
        ),
      ));
      $account->content['summary']['guestbook'] = array(
        '#type' => 'user_profile_item',
        '#title' => t('Guestbook'),
        '#markup' => $link,
        '#attributes' => array(
          'class' => 'guestbook',
        ),
      );
    }
  }
}