When adding a profile2 profile to a view, the fields from all profiles are referenced from the first profile relationship. For example, make a main profile with first_name and last_name and a member profile with member_name.

Create view of users, add a relationship to the main profile, called "main" (naming the relationships helps explain the problem). Add first_name and last_name to the view.

Next add a relationship to the member profile, called "member". Add member_name to the view.

The view shows empty data for member_name, and looking at the field list, the field that was added is "(main) Profile: member_name".

If you remove the field, go to Relationships and reorder the relationships so that "member" is first, then add the member_name field back, the correct field is used ("(member) Profile: member_name), and the data now appears in the view.

Comments

mikel1 created an issue. See original summary.

rickj’s picture

Status: Active » Closed (works as designed)

This is a characteristic of Views and the way it handles relationships. You need to add a separate relationship for each profile type, then each field can be associated with the correct profile. I have four profile types (I used to have five), and a lot of user views, some quite complex, and it all works fine using this technique.

In all situations where you have relationships in Views (not just users and profiles), there is nothing that automatically associates a field with the correct relationship. It's very easy to create a field and forget to select the relationship, resulting in null field results. This might arguably be called a bug, but in any event it's a Views issue, nothing to do with Profiles per se.