Lets say I (authorised user) am viewing either the blog, images, profile of User X. I am trying to add a box showing the information of the user X with avatar, name and links to Make me a friend, Add to Favorites (similar to TeamSugar.com). When I tried to use the code $user->uid, $user->avatar, it is showing my information (logged in user) rather than showing User X information. I guess $user object holds the information of the logged in user rather than the User X information.
How can I get the User X information, or atleast the User ID of User X, so that I can use the function user_load and get the User X information.
Also when I tried to user function user_load in a block, it says call to undefined function. Why was I not able to user Drupal functions in my custom blocks. What should I do to access drupal functions in blocks?
Thanks in advance for your cooperation.
Help is much appreciated.
Comments
Profile Page
If you're viewing a user's profile page (ex. ?q=/user/77), you can use arg(1) to get the user id.
Using Drupal Functions in Blocks
Thank you very much for your response.
Your suggestion should work even if I use CleanURLS and PathAuto modules, isn't it?
Also how can I access Drupal functions in the block. When I tried to use user_load() function in the block, I got function not defined error..
Thanks for help in advance.
How to achieve this when
How to achieve this when using automated alias for user pages? like http://xyz.com/user/xyz for xyz user. I want to custom theme a bit of the profile page for each role type and I want get the uid of the profile that is being viewed.
I achieved this using
I achieved this using this
jjjj
llllll