Displaying a standard picture when user has not uploaded a picture I am using the following code.

if ($logged_in) {
  $user = user_load($user-&gt;uid);
  print theme('image_style', array('style_name' =&gt; 'thumbnail_scale_n_crop_120_x_120', 'path' =&gt; $user-&gt;picture-&gt;uri));
}


It displays the user's picture.

How should I modify it so that so that when the user has NOT uploaded or has deleted his picture a standard "no photo" picture is displayed instead as in:

$no_avi = "http://example.com/sites/default/files/nophoto.jpg";
echo("&lt;img src=\"$no_avi\" /&gt;");


The User Picture Field module does not provide this capability.
Basing on the code used by template_preprocess_user_picture(), I would suggest the following code.

if (!empty($user-&gt;picture)) {
  if (is_numeric($user-&gt;picture)) {
    $account-&gt;picture = file_load($user-&gt;picture);
  }
  if (!empty($user-&gt;picture-&gt;uri)) {
    $filepath = $user-&gt;picture-&gt;uri;
  }
}
elseif (variable_get('user_picture_default', '')) {
  $filepath = variable_get('user_picture_default', '');
}
if (isset($filepath)) {
  $alt = t("@user's picture", array('@user' =&gt; format_username($account)));
  if (module_exists('image') &amp;&amp; file_valid_uri($filepath)) {
    $user_picture = theme('image_style', array('style_name' =&gt; 'thumbnail_scale_n_crop_120_x_120', 'path' =&gt; $filepath, 'alt' =&gt; $alt, 'title' =&gt; $alt));
  }
  else {
    $user_picture = theme('image', array('path' =&gt; $filepath, 'alt' =&gt; $alt, 'title' =&gt; $alt));
  }
}


If you didn't need to use a specific style, but you could use the one set in Drupal settings, the code would simply be the following one.

$user_picture = theme('user_picture', array('account' =&gt; $user));


Keep in mind that there are some places where Drupal already shows the user's picture. If you just need to change the image style used for the user's picture, that is possible from Drupal settings (see this other answer). If you need to show the user's picture in a page where Drupal doesn't show them, I would set the default image style for the user's picture in Drupal's admin settings, and use the following code.

$user_picture = theme('user_picture', array('account' =&gt; $user));