I want to build a view that shows me the group membership of a user that flagged a node to compare it with the group ref of the node.
Problem I experience seems like a bug. The field that should list the flagger's groups has a OG Membership relation and all of this type seem to fail with an SQL error message:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS og_membership_users_, node.created AS node_created, '' AS field_data_og_group' at line 1
The complete query:
SELECT DISTINCT users_flag_content.uid AS users_flag_content_uid, users_flag_content.name AS users_flag_content_name, og_membership_users. AS og_membership_users_, node.created AS node_created, '' AS field_data_og_group_ref__entity_type
FROM
{node} node
INNER JOIN {flag_content} flag_content_node ON node.nid = flag_content_node.content_id AND flag_content_node.fid = '2'
LEFT JOIN {users} users_flag_content ON flag_content_node.uid = users_flag_content.uid
INNER JOIN {og_membership} og_membership_users ON users_flag_content.uid = og_membership_users.etid AND og_membership_users.entity_type = 'user'
WHERE (( (node.nid = '3645' ) ))
ORDER BY node_created DESC
In og_membership_users. AS the field part gets truncated, which happens btw. with all OG membership relation fields.
Comments
Comment #1
ndobromirov CreditAttribution: ndobromirov commentedStill present in 2.6
Comment #2
edvanleeuwenThis is still present. With this you cannot list each user with the groups he's a member of.
Comment #3
ndobromirov CreditAttribution: ndobromirov commentedMoving to dev version, as apparently this is not worked on.
Comment #4
reswild CreditAttribution: reswild as a volunteer commentedIf I remember correctly, the problem is that these relationships only work one way. So it's possible to list the groups a user is a member of, but you might have to re-write your views in order to do this.
Se related discussion at https://www.drupal.org/node/1238186
Comment #5
jacob.embree CreditAttribution: jacob.embree at St. Louis Integration commentedCheck #4 from #2575833: OG entityreference field breaks Views when the field is attached to multiple entity types. I believe this issue is a duplicate of that one.