I have a block on the user profile page that is displaying information on user software licenses. For this site, users can have many software license serials and they are displayed in a scrolling text box on their profile page.

I'm taking the userID from global $user, but if an Administrator is logged in, then the only user ID known at that point is the logged in admin, so what gets displayed on ANY user page is a list of the Admin's licenses, not the users licenses.

If you search for a user (search/user), the URL you get when you click on a user is 'users/the_user_name', but if you edit a user you get 'user/user_id#', so you can't just parse the URL to get the user number.

The solution to this would be to make the userID OF THE USER IN QUESTION available in a variable or an array inside the profile page(?)

Yes, I can override the profile page, but it seems perfectly logical to be able to have the user ID available on the profile page for that particular user.

Comments

Jooblay.net’s picture

Yes this may help you out...
1. Create a "user" view and call the block user_profile_0 or something you really do not need the page. Unless your going for totally new user view page tab.
2. Edit the view block and add the fields you see fit.
3. Set the arguments or CONTEXTUAL FILTERS to User: Uid to call the users url. This will limit the entire view to only call the current user url. Provide default value User id from logged in user

save

hit the block admin and set the block where you want it and then navigate to the /user page. You should see your admin uid and any other fields. now if you switch users and or login as any other user your url will pull from that user.

you may have to play with this but it can be done...

Version: 7.23 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.