You are here

function _guestbook_user_profile_link in Guestbook 7.2

Same name and namespace in other branches
  1. 5.2 guestbook.module \_guestbook_user_profile_link()
  2. 5 guestbook.module \_guestbook_user_profile_link()
  3. 6.2 guestbook.module \_guestbook_user_profile_link()
  4. 6 guestbook.module \_guestbook_user_profile_link()

Return a link to $uid's profile if context allows it.

1 call to _guestbook_user_profile_link()
theme_guestbook in ./guestbook.module
Render a guestbook.

File

./guestbook.module, line 1126

Code

function _guestbook_user_profile_link($uid) {
  global $user;
  $guestbook_mode = variable_get('guestbook_mode', GUESTBOOK_SITE_GUESTBOOK | GUESTBOOK_USER_GUESTBOOKS);
  $output = '';
  if ($uid && $guestbook_mode & GUESTBOOK_USER_GUESTBOOKS && user_access('access user profiles') && $uid != $user->uid) {
    $guestbook_user = user_load_multiple(array(
      $uid,
    ), array(
      'status' => 1,
    ));
    $guestbook_user = reset($guestbook_user);
    if ($guestbook_user->uid && empty($guestbook_user->guestbook_status)) {
      $namelink = l($guestbook_user->name, "user/{$uid}", array(
        'attributes' => array(
          'title' => t('View user profile.'),
        ),
      ));
      $output .= '<div class="submitted">' . t("Visit !username's profile", array(
        '!username' => $namelink,
      )) . '</div>';
    }
  }
  return $output;
}