You are here

function imagecache_profiles_comment in ImageCache Profiles 6

Implements hook_comment().

Change comment user pictures to use the preferred imagecache preset.

File

./imagecache_profiles.module, line 291

Code

function imagecache_profiles_comment(&$comment, $op) {
  if ($op == 'view' && 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_result(db_query("SELECT picture FROM {users} WHERE uid = %d", $comment->uid));
    }
    if ($preset = variable_get('user_picture_imagecache_comments', '')) {
      $comment->imagecache_preset = $preset;
    }
  }
}