Hi,

Thank you for responding to my previous posting, which you moved to ImageCache, yet sorry but I don't think it belongs there ..

In the output of the user_visits.module you have:

$output .= theme('user_picture', $account);

You responded with:

If you want to add manually an image and apply an imagecache preset on it, you need to add a code snippet to the desired .tpl.php file:

<?php
    print theme('imagecache', $preset, $image['filepath'], $alt, $title,  $attributes);
    ?>

So, replacing

<?php
$output .= theme('user_picture', $account);
?>

with something like

<?php
$output .= theme('imagecache', 'YOUR_PREVIOUSLY_CREATED_PRESET', $account->picture, $alt, $title,  $attributes);
?>

should do the trick (untested).

============================

The problem is .. I don't want to change my user picture everywhere on the site, just to make it small on user_visits.module which is my preset in imagecache 'profile_small'.

============================

Would appreciate your help, and again, thank you for your wonderful module.

Comments

sanduhrs’s picture

Assigned: Unassigned » sanduhrs
Status: Active » Fixed

Still the same solution.
Just place the following function in your themes template.php

function YOUR_THEME_NAME_user_visits($account, $timestamp = NULL, $referer = NULL) {
  $output  = '<div class="profile">'."\n";
  $output .= theme('imagecache', 'YOUR_PREVIOUSLY_CREATED_PRESET', $account->picture, $alt, $title,  $attributes);
  $output .= ' <div class="name">'. theme('username', $account) .'</div>'."\n";
  if ($timestamp) {
    $output .= $timestamp ? ' <div class="visit">'. t('!time ago', array('!time' => format_interval(time() - $timestamp))) .'</div>'."\n" : '';
    $output .= $referer ? ' <div class="referer">'. t('Referer !link', array('!link' => l($referer, $referer))) .'</div>'."\n" : '';
  }
  $output .= '</div>'."\n";
  return $output;
}

See the docs [1] for more info on themeable functions:

[1] http://drupal.org/node/55126

Liliplanet’s picture

Thank you sanduhrs for your reply ..

I added the following to my template:

function endless_news_user_visits($account, $timestamp = NULL, $referer = NULL) {
  $output  = '<div class="profile">'."\n";
  $output .= theme('imagecache', 'profile_small', $account->picture, $alt, $title,  $attributes);
  $output .= ' <div class="name">'. theme('username', $account) .'</div>'."\n";
  if ($timestamp) {
    $output .= $timestamp ? ' <div class="visit">'. t('!time ago', array('!time' => format_interval(time() - $timestamp))) .'</div>'."\n" : '';
    $output .= $referer ? ' <div class="referer">'. t('Referer !link', array('!link' => l($referer, $referer))) .'</div>'."\n" : '';
  }
  $output .= '</div>'."\n";
  return $output;
}

and sorry, no difference here .. still the big profile picture. My theme is 'endless_news' and my imagecache preset is 'profile_small'.

Did I do that correctly? Most appreciate your help, and thank you again.
Lilian

sanduhrs’s picture

Status: Fixed » Closed (fixed)

Really, this is well documented and no issue with the module.
Check the documentation for D6 [1] - you are at step 4 - or ask for support in the forums or on IRC.

[1] http://drupal.org/node/341628
[2] http://drupal.org/forum
[3] http://drupal.org/irc

Liliplanet’s picture

My absolute apologies .. after cron run it was updated and beautiful! Thank you so much!

czeky’s picture

hi, thanx, working fine... but .. is it possible to make the user picture clickable?

many thanx

zdenek

gitin’s picture

has anybody found the way to make pictures clickable..?
thanx
gee

czeky’s picture

I have this in a block, set to 5 users and user image is clickable

Albrecht Marignoni’s picture

It´s a very big problem...

Where is the problem with this?

/**
* kleine
*/
function user_visits($account, $timestamp = NULL, $referer = NULL) {
$output = '

'."\n";
$output .= theme('imagecache', 'user_image_default', $account->picture, $alt, $title, $attributes);
$output .= '
'. theme('username', $account) .'

'."\n";
if ($timestamp) {
$output .= $timestamp ? '

'. t('!time ago', array('!time' => format_interval(time() - $timestamp))) .'

'."\n" : '';
$output .= $referer ? '

'. t('Referer !link', array('!link' => l($referer, $referer))) .'

'."\n" : '';
}
$output .= '

'."\n";
return $output;
}

mmachina’s picture

I applied to code to the template

function YOUR_THEME_NAME_user_visits($account, $timestamp = NULL, $referer = NULL) {
  $output  = '<div class="profile">'."\n";
  $output .= theme('imagecache', 'YOUR_PREVIOUSLY_CREATED_PRESET', $account->picture, $alt, $title,  $attributes);
  $output .= ' <div class="name">'. theme('username', $account) .'</div>'."\n";
  if ($timestamp) {
    $output .= $timestamp ? ' <div class="visit">'. t('!time ago', array('!time' => format_interval(time() - $timestamp))) .'</div>'."\n" : '';
    $output .= $referer ? ' <div class="referer">'. t('Referer !link', array('!link' => l($referer, $referer))) .'</div>'."\n" : '';
  }
  $output .= '</div>'."\n";
  return $output;
}

everything works fine... the images have become the size that I need...

But they are no longer clickable. Anyway i can get the pictures to be able to link to the user profile?

Thanks!