Right now you will access different information about a user depending on what context you are viewing their profile. It would be desirable to improve this so no matter what context you are in, you will always see the same information.
E.g. if you are a teacher in one course and a student in another course, you will see information as if you were a teacher even if you view their profile in the context of the other course.
This will require finding out all contexts where you can view the user's profile and checking capabilities in a loop.
Performance is a real concern here. Displaying more information improves usability, but if it causes that page to load slowly in all cases, usability will be impacted significantly.