1

I am on Drupal 7. Hi, I have installed the Devel module and I am using it to help me theme the user-profile.tpl.php. I want to show the e-mail information only when the user looking into the user info page is the own user.

I am checking the currently logged in user with $user->uid.

Now I want to get the uid corresponding to the current user page to evaluate if they are the same so that I can print the e-mail. When I go to the Devel interface, it shows me the information I need on the Load area, when expanding the stdClass information.

How can I use these attributes on the stdClass? I was expecting to do something more or less like $somethinghere->uid to grab the current page user uid, but my trial-and-error process isn't working, I have tried everything... Thanks.

2

You should be able to get the account of the current page via

$account = menu_get_object('user');

and then check

if ($account->uid == $user->uid) 

menu_get_object will grab the loaded object based on the url

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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