Title says it all. Basically, I have a node type with a userreference CCK field. I want to create a View that shows the Content Profile fields for the user referenced in the userreference field. So I create a relationship based on the userreference field, then I create a Content Profile relationship based on that relationship. When I do this, though, I get a massive SQL error in red above the View preview.

Of course, the Content Profile relationship works normally when I am not basing the it on another relationship. However, when basing it on a userreference relationship, it creates the error I mentioned above. I've looked for solutions for a while now with no results. Help would be much appreciated if I'm just missing something.

Thanks!

Comments

tayzlor’s picture

can confirm i'm having this same issue when trying to create a view, where one of my content profile fields relates to the user relationships module. so i've added both to the relationships field in views, and when i try to join the content profile field with the UR field i get a big sql error also :(

jessepinho’s picture

Happened across this yesterday: http://drupal.org/node/471708
Perhaps the only way to fix it is to kinda hack it. This fix works for me for now, but it'd be nice if they committed it to the module.

phl3tch’s picture

Having the same issue, and the patch in #2 solves it. Thanks a mil.

tayzlor’s picture

does not seem to resolve it fully. There is still something wrong i think with the content_profile views handler.

i'n my view i'm trying to show the current user's friends content_profile field with the following sql -

SELECT DISTINCT(node.nid) AS nid,
   node_data_field_profile_fullname.field_profile_fullname_value AS node_data_field_profile_fullname_field_profile_fullname_value,
   node_users_user_relationships.nid AS node_users_user_relationships_nid,
   node_users_user_relationships.type AS node_users_user_relationships_type,
   node_users_user_relationships.vid AS node_users_user_relationships_vid,
   users_user_relationships.picture AS users_user_relationships_picture,
   users_user_relationships.uid AS users_user_relationships_uid,
   users_user_relationships.name AS users_user_relationships_name,
   user_relationship_types_user_relationships.name AS user_relationship_types_user_relationships_name
 FROM node node 
 LEFT JOIN user_relationships user_relationships ON node.uid = user_relationships.requester_id
 LEFT JOIN user_relationship_types user_relationship_types_user_relationships ON user_relationships.rtid = user_relationship_types_user_relationships.rtid
 LEFT JOIN users users_user_relationships ON user_relationships.requestee_id = users_user_relationships.uid
 LEFT JOIN users users_user_relationships_1 ON user_relationships.requester_id = users_user_relationships_1.uid
 INNER JOIN node node_users_user_relationships ON users_user_relationships.uid = node_users_user_relationships.uid AND node_users_user_relationships.type = 'basic_information'
 LEFT JOIN content_type_basic_information node_data_field_profile_fullname ON node_users_user_relationships.vid = node_data_field_profile_fullname.vid
 WHERE (user_relationships.approved = '1') AND (users_user_relationships_1.uid = ***CURRENT_USER***)

it seems to pull out all nodes or something. something wrong with the table joins at least. I'm investigating at the moment, but it's quite tricky.

tayzlor’s picture

ignore my last comment, i was running into problems as i was using a base table of Node instead of User.

fago’s picture

Darrin Southern’s picture

Version: 6.x-1.0-beta3 » 6.x-1.0-beta4

I too would like to display Content Profile CCK fields in a View and hopefully a Node, via the User Reference field, about the Author.
I've installed version 6.x-1.0-beta4, so I believe I am running the patched version that solves this issue.

I've been able to create a Views relationship via an extra local CCK field that I manually populate with the Profile Node ID.
I am then able to display the Author's Content Profile data in the current view.
Which is a bit of a work around, as I now need a method of auto entering the Profile Node ID from the Author of the Node.

I was hoping someone could explain further the method used to 'join' the relationships 'together'

Thanks in advance,