Maybe I'm missing something, but I just installed Guestbook on my test site today and it is acting weird in one way...

When an authenticated user signs a guestbook (either site or user) his comments display, but his user info (name) doesn't.

It works fine with Anonymous users.

I understand that what should happen is that the user name with a link to the users profile page should appear. It doesn't. Am I doing something wrong? Or is something broken?

Comments

jihanj’s picture

I encountered the same problem and it seems like it has to do with user pictures. I don't allow users to have their avatars on my drupal site and the code seems to indicate that this bug will be encountered only when the pictures are not used.

I changed my original code in guestbook.module from:

<code>
//
// Copy of theme_user_picture, with adjustments
//
function theme_guestbook_user_picture($uid) {

  $account = user_load(array('uid' => $uid));

  if (variable_get('user_pictures', 0)) {
    if ($account->picture && file_exists($account->picture)) {
      $picture = file_create_url($account->picture);
    }
    else if (variable_get('user_picture_default', '')) {
      $picture = variable_get('user_picture_default', '');
    }

    if (variable_get('guestbook_mode', -1) == GUESTBOOK_SITE_GUESTBOOK 
        && user_access('access user profiles')) {
       $user_link =  "user/$account->uid";
       $user_text = t('View user profile.');
    }
    else if (user_access('access user guestbooks')) {
       $user_link = "guestbook/$account->uid";
       $user_text = t('View user guestbook.');
    }
    else {
       $user_link = "guestbook";
       $user_text = t('View guestbooks.');
    }
 
    $output = l($account->name ? $account->name : variable_get('anonymous', 'Anonymous'), $user_link, $user_text);

    if (isset($picture)) {
      $alt = t('%user\'s picture', array('%user' => $account->name ? $account->name : variable_get('anonymous', 'Anonymous')));
      $picture = theme('image', $picture, $alt, $alt, '', false);
      if (!empty($account->uid) && user_access('access user profiles')) {
        $picture = l($picture, $user_link, array('title' => $user_text), NULL, NULL, FALSE, TRUE);
      }

      $output .= "<div class=\"picture\">$picture</div>";
    }

    return $output;
  }
}

to the following

<code>
function pushbutton_guestbook_user_picture($uid) {

  $account = user_load(array('uid' => $uid));

  if (variable_get('user_pictures', 0)) {
    if ($account->picture && file_exists($account->picture)) {
      $picture = file_create_url($account->picture);
    }
    else if (variable_get('user_picture_default', '')) {
      $picture = variable_get('user_picture_default', '');
    }
  }

  if (variable_get('guestbook_mode', -1) == GUESTBOOK_SITE_GUESTBOOK 
      && user_access('access user profiles')) {
     $user_link =  "user/$account->uid";
     $user_text = t('View user profile.');
  }
  else if (user_access('access user guestbooks')) {
     $user_link = "guestbook/$account->uid";
     $user_text = t('View user guestbook.');
  }
  else {
     $user_link = "guestbook";
     $user_text = t('View guestbooks.');
  }
 
  $output = l($account->name ? $account->name : variable_get('anonymous', 'Anonymous'), $user_link, $user_text);

  if (isset($picture)) {
    $alt = t('%user\'s picture', array('%user' => $account->name ? $account->name : variable_get('anonymous', 'Anonymous')));
    $picture = theme('image', $picture, $alt, $alt, '', false);
    if (!empty($account->uid) && user_access('access user profiles')) {
      $picture = l($picture, $user_link, array('title' => $user_text), NULL, NULL, FALSE, TRUE);
    }

    $output .= "<div class=\"picture\">$picture</div>";
  }

  return $output;
}

and now it seems to work fine.

Anonymous’s picture

After applying this fix I found that this problem occurs when the user does not have the permission:
user module > access user profiles.

roleychiu’s picture

i tried the above fix as mentioned, but all it seems to do is disable the avatars and leaves me with no author and no avatars visible. any updates on a workable fix?

sun’s picture

Status: Active » Closed (won't fix)

Sorry, 4.7.x is no longer supported. Feel free to re-open this issue if you want to provide a patch.