When attempting to setup a view that shows users and their profiles, the only relationship from User -> Profile that is available is all profiles of all types. You can then add a filter on the view to filter for a specific set of profiles, but you can not easily control the granular configuration of those profiles such as their order, or a mixture of data from various profiles.

For example, consider you have the following 2 profile types with fields:

  • Personal Profile
    • Name
    • Interests & Hobbies
  • Professional Profile
    • Job Title
    • Phone Number

And consider that you would like to create a view of users that show the following fields:

  • (Personal Profile) Rendered Entity
  • (Professional Profile) Job Title

With the current "All profiles" relationship, there is no way to show the Personal Profile as a rendered entity without it also showing the Professional Profile as a rendered entity. Hopefully this makes sense.

To show specific profiles and possibly show them differently, I'm proposing we add a new relationship for a single profile type. Attached is a patch that adds a new views relationship for a single selected Profile Type. When adding this relationship, the user then selects the Profile bundle that is related.

Unfortunately, I'm not familiar enough with testing to also add an automated test to this patch. Thoughts and feedback are welcome.

Comments

daggerhart created an issue. See original summary.

Status: Needs review » Needs work

The last submitted patch, single-profile-type-views-relationship.patch, failed testing. View results

daggerhart’s picture

Status: Needs work » Needs review
StatusFileSize
new3.97 KB

Attempting new patch that adds the new relationship file correctly.

maaty388’s picture

Status: Needs review » Reviewed & tested by the community

Actually, this patch works great
I tried to implement your patch into default profile relationship because now we have two relationships since with your patch I think we don't need it.
Let me now

daggerhart’s picture

I agree that the current relationship is not very valuable compared to the one this patch adds. The reasons I created a new relationship is because the module is in beta, and changing how the existing relationship works on current sites would be a breaking change. Happy to make any adjustments we decide.

Any maintainers around to provide thoughts & feedback?

daggerhart’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new3.41 KB

There are some issues with my patch. Mainly that I over complicated it, but also I had left some inappropriate code in place from where I was learning to make custom relationships (taxonomy term stuff).

Here is a complete re-roll that simplifies the relationship class and fixes those issues.

maaty388’s picture

Status: Needs review » Reviewed & tested by the community

Still works great
Is it possible to see git diff between this 2 patches to see a difference?

daggerhart’s picture

StatusFileSize
new1.27 KB

Sure thing, here is the interdiff between patch #3 and patch #7.

maaty388’s picture

Okay Thank you,
I see there is a lot less code Good job

mglaman’s picture

Crediting matjaz_zavski for testing manually. I'm not a big fan of Views, but in playing around this seems to make life easier for heavy Views users.

  • mglaman committed d1461f9 on 8.x-1.x authored by daggerhart
    Issue #2905474 by daggerhart, matjaz_zavski: Views relationship for a...
mglaman’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.