Closed (fixed)
Project:
Organic Groups
Version:
5.x-8.x-dev
Component:
Og Views
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
8 Jul 2008 at 17:05 UTC
Updated:
29 Aug 2009 at 03:23 UTC
It would be nice to have a select (selector/listbox) control filter for views that could let people filter calendar events for example by selecting an existing group, rather than having to type in a group name or remember a group ID number.
Comments
Comment #1
moshe weitzman commentedthats a Views request for dropdown of node titles. not specific to OG
Comment #2
dugh commentedViews already has this feature, and you are already using it for other og filters.
Here's the code to actually do what I was requesting. Modify if you wish to prevent private groups from being listed in the listbox, but I prefer it this way. If someone selects to see nodes from a group to which they don't belong, they just get an empty list (or calendar).
I added it to og_views.inc around line 157:
Comment #3
bonobo commentedRather than modifying core OG code (or really, any core code, which will get unsustainable over time) set a views header that lists all the groups you want to expose. Then, pass the nid of the group to a view as an argument. This assumes, of course, that you have set your view to accept group nids as arguments.
Comment #4
dugh commentedYes it is unsustainable to keep having to add this code to your own copy of the module, which is why I posted this feature request.
Comment #5
dugh commentedI'm already using this in views all over our website, it works fine.
http://itls.usu.edu/calendar
http://itls.usu.edu/calendar/upcoming
http://itls.usu.edu/trackchanges
and others
Comment #6
najibx commentedcool. the above hack to og_views.inc, would list down all groups isn't?
I am not clear about comment#3.
We put an HTML select list form of only selected group we want to list down in the views' header section? and of course as you said set view to accept group nids as arguments.
Comment #7
mshaver commentedIt would be great to get something similar added to Drupal 6.x and Views2. It would involve creating a new handler and doing things in the new Views2 api way, which I'm not quite familiar with yet.
Comment #8
esclapes commentedsubscribe
Comment #9
moshe weitzman commentedComment #10
samhassell commented+1, seems to be a basic view compared to some of the stuff already supplied by og.
in #3, did bonobo mean a views handler, instead of a views header?
Comment #11
dugh commentedComment #12
dugh commentedNo, bonobo meant you manually type in links to all the group names in the header of a view. Our site we get new groups all the time - I don't want to have to manually edit the view header each time a new group is made.
I'm about to upgrade our site to drupal 6, I'll see what changes to that snippet of code are necessary to make it work in drupal 6.
Comment #13
bonobo commentedActually, while it could be done by manually typing in links in the views header, we usually do it as a php snippet that outputs the list. Then, we pass the "right" argument to the view.
Then, depending on how the site is being used, we break that code out into a site-specific module; ie, a yoursite.module that contains the site-specific modifications.
And with all that said, I suspect that between Views and OG in D6 that this will be a lot easier -- Given that you can set the terms included in filters for views this might Just Work in D6.
Comment #14
sethcohn commentedopen for a patch here if someone still wants this for D5 + Views 1.
Comment #15
najibx commentedwhile this exposing listing of groups for views, how about listing og groups when adding/editing node? ie. refering to another group for certain node?
Comment #16
dugh commentedThere is built-in support for this in the drupal 6 version of OG and Views 2, so I'm closing this.