By roleychiu on
I want to show a link to edit one's photo gallery only if the Current User matches the UID of the user profile he is viewing.
When i print out global $user, thats me,
When i print out $user-uid, thats the UID of the current user profile i am viewing--which could be someone elses personal page.
How do I reference the Global UserID and the User Profile UserID on the same page?
Any hints?
Comments
additional comment: My
additional comment:
My problem lies in the fact that if i add in the code,
I'm not sure what's going on
I'm not sure what's going on with $user-uid, but if you're on a profile page, you can grab the uid of that profile from arg().
http://api.drupal.org/api/function/arg
Yeah i can grab the userID
Yeah i can grab the userID no problem in either the args or $user->uid, but then how would I referrence my own userID while I am viewing someone else's user profile?
:( :(
Isn't that the one you grab
Isn't that the one you grab from $user->uid?
global $user should return the user object for the current user viewing the page -- ie you.
Yeah therein lies the
Yeah therein lies the problem. Once i grab "me" through global user with a "global $user" statement all user profiles go blank because those pages rely on $user-uid being that current user profile #i am viewing-- i.e. arg(1) in blah.com/user/#. Now I'm wondering if there is a way to call "me" (the user object) without using "global $user" so that i can have both "me" and the $user-uid at the same time so I can compare the two for my if statement.
This is my pseudo code:
Use this for the viewers
Use this for the viewers UID
and use this for the user profile uid