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

ndobromirov’s picture

Version: 7.x-2.2 » 7.x-2.6
Priority: Major » Critical

Still present in 2.6

edvanleeuwen’s picture

Version: 7.x-2.6 » 7.x-2.9

This is still present. With this you cannot list each user with the groups he's a member of.

ndobromirov’s picture

Version: 7.x-2.9 » 7.x-2.x-dev

Moving to dev version, as apparently this is not worked on.

reswild’s picture

If 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

jacob.embree’s picture