0

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'];<br>
    if ($account->uid != $profile->uid) {<br>
      do something here.<br>
    }

That looks like it is what I need, but I don't seem to be able to implement it. Any help would be appreciated.

1 Answer 1

1

Try with :

global $user; //is the current user

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

if ($user->uid != $user_id){
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.