0

I have a D7 site where users are linked to other users (by References). User profiles are extended using the Profile 2 module and by so, containing some additional fields (phone, email,...).

I want to create a landing page where logged in users can see the info of the connected profile. So a logged in user should see the name, phone and email of the linked account.

I've been trying around for a while, but not able to close this issue.
It's not a matter of permissions, since the direct URL (/profile-representative/16) is accessible by the logged in user. On that page, he can see all the info. It's that info (phone, email,...) I want to get into Views.
But for some reason, it cannot be done by using relationships. At least not by me.

Is there anyone with experience concerning this matter?

1

I managed to fix this issue with a combinations of a relationship and a custom formatter.

First, in a (User) view, I created a contextual filter with User: Uid. Of course, no contextual filter will be given at the page, so I provided the default value User ID from logged in user.

Then, I created two relationships. The first one User: Profileand the second one Profile: [your custom name]. The second relationship is created with the first one as relationship.

Next, in my Fields section of my view, I added a Profile field and gave it a custom formatter. By using this custom formatter, I was able to display all the needed data.

If someone is interested in more code, please let me know!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.