How to override the default image style for displaying user picture? I have Statuses Module installed on one of my site. I have created a view to display the status along with the user picture and the following comments.

The view displays the user picture along with the statuses, but the image style used is the default 'thumbnail' style. I have created my own image style for displaying these images.

Usually in a view when images are added we get a option by default to add image style to it. But in this case I dont have that option.

After a bit of searching I found the following code in the statuses.module to display the user picture:

function statuses_display_user_picture($account, $preset = NULL) {
  drupal_add_css(drupal_get_path('module', 'statuses') .'/resources/statuses.css');
  $image_vars = array('account' =&gt; $account);
  if (!empty($preset) &amp;&amp; module_exists('imagecache_profiles')) {
    $image_vars['user_picture_style'] = $preset;
  }
  return theme('user_picture', $image_vars);
}


How do I override this code to display the image with my choice of 'image style'.
Use hook_preprocess_user_picture(). See template_preprocess_user_picture().

Here a sample code:

/**
 * Implements hook_preprocess_user_picture().
 *
 * @see template_preprocess_user_picture().
 */
function example_preprocess_user_picture(&amp;$variables) {
  $style = 'your_style';

  $account = $variables['account'];
  if (is_numeric($account-&gt;picture)) {
    $account-&gt;picture = file_load($account-&gt;picture);
  }
  if (!empty($account-&gt;picture-&gt;uri)) {
    $filepath = $account-&gt;picture-&gt;uri;
  }

  if (isset($filepath)) {
    $alt = t("@user's picture", array('@user' =&gt; format_username($account)));
    $variables['user_picture'] = theme('image_style', array('style_name' =&gt; $style, 'path' =&gt; $filepath, 'alt' =&gt; $alt, 'title' =&gt; $alt));
  }
}