Programmatically load the uid of the owner of a viewed profile2 entity Using Display Suite together with Profile2 and Flags. I want one of my flags to be visible on the profile2 page, but only to the owner of the profile page and to the administrator.
I try adding a code field with Display Suite. I can get the field to display, I can get it to display to only administrators, but I don't find a way to allow only owner and administrator to view the flag.
What I need is the uid of the user viewing a profile (I've got that one), and then I need the uid of the owner of the profile being viewed, and compare them.
The profile2.module source has the following lines:

$account = isset($account) ? $account : $GLOBALS['user'];&lt;br&gt;
    if ($account-&gt;uid != $profile-&gt;uid) {&lt;br&gt;
      do something here.&lt;br&gt;
    }


That looks like it is what I need, but I don't seem to be able to implement it. Any help would be appreciated.
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){
}