How to hide user picture based on the value of a field in their profile
template_preprocess_user_picture seems to be fair enough approach to me, the hook should be able to unset profile picture from any instance including views etc.

Only thing I doubt could go wrong in your code is conditional unsetting of images. To make sure could you comment out the condition

function MYMODULE_preprocess_user_picture(&amp;$variables) {
        $variables['user_picture'] = '';
}


If that unset your field than problem can be narrowed to make the condition working.

Probable problem with your condition
Can you check if you are getting fields in $variables['account'] object$variables['account'], if not you might need to object the user account and check the field conditions

$uid = $variables['account']-&gt;uid;
$account = user_load($uid);
function MYMODULE_preprocess_user_picture(&amp;$variables) {
  if ((!isset($account-&gt;field_user_publish_photo) || $account-&gt;field_user_publish_photo[LANGUAGE_NONE][0]['value'] == '0') &amp;&amp; $variables['logged_in'] != 1) { // hide user photo when Publish photo is turned off
      $variables['user_picture'] = '';
  }
}