I'm logged in as admin, and go to view a user's account page. How can I get the id of the user I'm viewing, rathe开发者_如何学运维r than the $user->uid (which would be the admin user id)?
The user's ID is in the URL of the user edit form.
http://example.com/user/1/edit
If you have the devel module installed (and you should), there'll also be a devel tab on the user's profile page that'll let you see other information about the user.
If you're talking about the user's profile template (i.e. you're overriding user-profile.tpl.php
), the user you're viewing is in the $account
variable.
Use the Devel module and you will get every kind of information you wanted.
do a print_r($node) in the correct file or use devel like Vivek suggested
精彩评论