You are here

function imagecache_profiles_comment_view in ImageCache Profiles 7

Implements hook_comment_view().

Change comment user pictures to use the preferred image style.

File

./imagecache_profiles.module, line 183

Code

function imagecache_profiles_comment_view($comment) {
  if (theme_get_setting('toggle_comment_user_picture')) {

    // If this is a comment preview, we need to manually add $comment->picture.
    if (!empty($comment->uid) && !isset($comment->picture)) {
      $comment->picture = db_query("SELECT picture FROM {users} WHERE uid = :uid", array(
        ':uid' => $comment->uid,
      ))
        ->fetchField();
    }
    if ($style = variable_get('user_picture_style_comments', '')) {
      $comment->user_picture_style = $style;
    }
  }
}