Access $user object on comments
In drupal by default anonymous users have UID=0 , and you just need if $user->uid==0 set your variable to what you want , some string like "mehman" , 

because of doing little changes in your code I use inverse checking  of uid value ( the are as the same , 

if ( $user-&gt;uid ==0 )  $variables['persianName'] ='mehman';    


or   

if ( $user-&gt;uid !=0 ) ...... else  $variables['persianName'] ='mehman';


)    

function apblog_preprocess_comment(&amp;$variables) {
  $user = $variables['user'];
  $user = user_load($user-&gt;uid);
  $persianName = field_get_items('user', $user, 'field_user_pname');
  if ($user-&gt;uid !=0) {
    $variables['persianName'] = $persianName[0]['safe_value'];
  }
  else {
    $variables['persianName'] ='';
  }

  // …
}


I hope this work to you

be win ;)