When creating the join object at line 39 of content_profile_views_handler_relationship.inc the left table is 'users' by default and ignores the 'relationship' member of the query object. This is not a problem when using only one content profile relationship but on more complex queries this is a problem.

For example if you create a query somewhere along the lines of

USER->content_profile->referenced_users->their_content_profiles

the whole thing fails at the 'referenced users' stage of the chain because it ignores the relationship member of the query object.

To fix this for my own purposed I edited line 39 like so:

'left_table' => $this -> relationship ? $this -> relationship : 'users',

Thanks for your work on this module.

Comments

leahecooper’s picture

Thank you for this! Also helped with a similar problem I was having where I needed to create a views relationship to a content profile table from another table which was connected to my primary table through a relationship. Before your fix, the view was returning an empty set of records because it assumed my content profile table linked to the primary table instead of the linked table.

fago’s picture

Version: 6.x-1.0-beta3 » 6.x-1.x-dev
Status: Active » Needs work

Sounds good, could you provide a patch?

whodies’s picture

I'm ashamed to admit, I don't really know how to make one.

But its really only that one line that needs editing.

phl3tch’s picture

I can verify this fixes the problem. Hope it gets rolled into a future release.

fago’s picture

Status: Needs work » Fixed

As some people reported this fixes the problem, I've incorportated a slightly improved version. Please test whether the next generated dev-snapshot works for you.

bobgeier’s picture

Subscribing... will check the patch over the weekend.

bobgeier’s picture

I can verify that the most recent dev works with Views 2.6. Thanks for the effort!

mrfelton’s picture

I also confirm that the latest code in -dev now works correctly. Thanks

kompatv’s picture

I confirm this code worked for me. Thank You for your help.

Status: Fixed » Closed (fixed)
Issue tags: -views relationships

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