Programmatically load the uid of the owner of a viewed profile2 entity
Try with :

global $user; //is the current user

// you can get the viewing user id :
$user_id = arg(1);

if ($user-&gt;uid != $user_id){
}