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
Comment #1
leahecooper commentedThank 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.
Comment #2
fagoSounds good, could you provide a patch?
Comment #3
whodies commentedI'm ashamed to admit, I don't really know how to make one.
But its really only that one line that needs editing.
Comment #4
phl3tch commentedI can verify this fixes the problem. Hope it gets rolled into a future release.
Comment #5
fagoAs 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.
Comment #6
bobgeier commentedSubscribing... will check the patch over the weekend.
Comment #7
bobgeier commentedI can verify that the most recent dev works with Views 2.6. Thanks for the effort!
Comment #8
mrfelton commentedI also confirm that the latest code in -dev now works correctly. Thanks
Comment #9
kompatv commentedI confirm this code worked for me. Thank You for your help.