Download & Extend

Error when creating a view for groups a user is in, with member count

Project:Organic groups
Version:6.x-2.0
Component:Og Views
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

I have used the instructions posted by tevih to create a view which shows all the groups a particular user is a member of. Note that this is not the same as the og_my_groups view, as it is in the context of the user profile page you are looking at, rather than the current user.

I have copied these instructions below:

  1. create new view of type "User"
  2. Click the plus image under "Arguments" to add a new argument of "UID"
  3. (You will get errors popping up at this point, but just disregard them)
  4. Create a relationship: Organic Groups: Group node (Member)
  5. Add a field - I added "node: title" and "organic groups: organic group description"
  6. I created a new display of page (I know, OP was asking about block. I was interested in page view.)
  7. Path: "user/%/mygroups" to pass the argument to the page
  8. Menu: "Tab: My Groups"

The view constructed by tevih works fine, however, when I add the field "members count" I get the following error message:

user warning: Unknown column 'og.nid' in 'where clause' query: SELECT users.uid AS uid, node_og_uid.title AS node_og_uid_title, node_og_uid.nid AS node_og_uid_nid, node_og_uid__og.og_description AS node_og_uid__og_og_description, (SELECT COUNT(*) FROM og_uid ou INNER JOIN users u ON ou.uid = u.uid WHERE ou.nid = og.nid AND u.status > 0 AND ou.is_active >= 1 AND ou.is_admin >= 0 ) AS member_count FROM users users LEFT JOIN og_uid og_uid ON users.uid = og_uid.uid LEFT JOIN node node_og_uid ON og_uid.nid = node_og_uid.nid LEFT JOIN og node_og_uid__og ON node_og_uid.nid = node_og_uid__og.nid WHERE users.uid = 1 LIMIT 0, 10 in .../sites/all/modules/views/includes/view.inc on line 765.

This looks to me like a bug in OG. However, if someone can point me to where I am going wrong, I would be very grateful.

Thanks

Comments

#1

Any thoughts?

#2

Here's my view export if that helps.

AttachmentSizeStatusTest resultOperations
og_my_groups.txt5.27 KBIgnored: Check issue status.NoneNone

#3

I managed to create a view for displaying all groups of a particular user. My solution is a bit different from tevih's and you can find the solution at http://drupal.org/node/455890#comment-2824884. I've also attached an export of my view there. I didn't add a member count to my view, but you might try adding that...

Let me know if (and how) it works!!

#4

Update - I added the member count field and it works fine!! I've attached an export of the view containing the member count field..

AttachmentSizeStatusTest resultOperations
user_groups_with_member_count_view.txt5.13 KBIgnored: Check issue status.NoneNone

#5

Status:active» closed (duplicate)

#1220458: Member Count field doesn't use relationship

nobody click here