Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This patch adds a views filter that can filter users by group. I think this fixes #371628: Views filter "Group member" not working as expected.
Comment | File | Size | Author |
---|---|---|---|
#45 | og-filter_users_by_group-405546-45.patch | 1.08 KB | soulfroys |
#39 | og-filter_users_by_group-405546-39.patch | 1.49 KB | jeffschuler |
#39 | og-field-n.png | 8.48 KB | jeffschuler |
#32 | og-405546-32.patch | 2.24 KB | bschilt |
#20 | 405546_filter_users_by_group.patch | 2.46 KB | msonnabaum |
Comments
Comment #1
Rosamunda CreditAttribution: Rosamunda commentedsubscribing. Totally agree.
Comment #2
moshe weitzman CreditAttribution: moshe weitzman commentedJust from a quick code review. You have to filter for only published groups in value_options method. Further, you can just use node table and filter for the group content types. Would avoid a JOIN.
Comment #3
ariflukito CreditAttribution: ariflukito commentedok here is the updated one.
Comment #4
ariflukito CreditAttribution: ariflukito commentedComment #5
AfterSys CreditAttribution: AfterSys commentedseems working, patched to latest stable OG (6.x-1.3) without a hitch, im using this on a dev site and if i notice anything wrong ill post here, i should have it hammered enough after a week from today
code is simple enough and should really go into OG, ive wasted precious hours trying to figure this out with what was provided default by OG..
Comment #6
abaddon CreditAttribution: abaddon commented(comment removed - probably posted to the wrong issue)
Comment #7
moshe weitzman CreditAttribution: moshe weitzman commenteddoe this get pending members also? that should be an option, no?
Comment #8
ariflukito CreditAttribution: ariflukito commentedThis one just filter a list of users by certain group, if you want to filter the list without pending members shouldn't it be provided by a new filter?
Comment #9
moshe weitzman CreditAttribution: moshe weitzman commentedno - filters can have settings and we should use them in order to avoid too many filters
Comment #10
ariflukito CreditAttribution: ariflukito commentedbut I think it doesn't make sense to put the setting on this filter, you can have settings but you can't expose them. OK maybe it makes sense if you don't expose the filter, you can filter pending/active users from certain group but if you want to expose this filter this setting is not really useful. Anyway looking at this handler og_views_handler_field_og_uid_groups, it displays the group regardless the user is a pending member or not. I just want to have filter based on what displayed on this field.
Comment #11
dugh CreditAttribution: dugh commentedPending members aren't members of the group yet. If that option was wanted, it should be a new issue posted.
See also this issue and its patch: http://drupal.org/node/507770
Comment #12
Owen Barton CreditAttribution: Owen Barton commentedAttached is a patch (rediffed to remove fuzz) from brian.schilt at #507770: og_views: filter users by group (which I marked as a duplicate).
This works for me - since this is already very useful, I agree that adding settings for pending would perhaps be better as a subsequent patch.
Comment #13
afox CreditAttribution: afox commentedPatch has been working for our site for months now, no reports on errors. Should this be considered RTBC or should we wait for pending members patch? Comments anyone?
Comment #14
YesCT CreditAttribution: YesCT commentedhow is this different than the
(Group node (member)) Organic groups: Group types
filter?
Comment #15
YesCT CreditAttribution: YesCT commentedin #12 Owen says there is a patch attached (rediffed) but there is no attachment... ?
Comment #16
amitaibuThe patch that exists in #3 is already covered by og_views_handler_filter_og_type. Reseting back to "Active" until a proper patch is provided.
Comment #17
bryancasler CreditAttribution: bryancasler commentedCan anyone provide an update on the status of this patch?
Comment #18
msonnabaum CreditAttribution: msonnabaum commentedHere's a re-rolled version of the patch from #507770: og_views: filter users by group that should apply cleanly to the latest OG.
Seems to be working fine for me so far.
Comment #19
amitaibuFiles are missing? Where the file holding og_views_handler_filter_og_uid_nid() ?
Comment #20
msonnabaum CreditAttribution: msonnabaum commentedGood call. Forgot to fakeadd it.
Comment #21
rdiazjokyo CreditAttribution: rdiazjokyo commentedhey any update on this patch? #20 doesn't seem to be working for me. this filter shows up as an option:
Organic groups: Group
OG: Members that belong to a group
but once I choose the filter, it doesn't produce any query results. all results are hidden.
I'm trying to make a "directory" listing of content profiles, where there can be an option to filter users by group membership.
Any updates or guidance would be much appreciated.
Comment #22
rdiazjokyo CreditAttribution: rdiazjokyo commentednever mind. it works perfectly as a user view, not a node view. i just used a content profile relationship to get it to work perfectly.
Comment #23
chellman CreditAttribution: chellman commentedPatch #20 did just what I was looking for.
Comment #24
bryancasler CreditAttribution: bryancasler commentedI can also confirm that #20 works for me
Comment #25
geerlingguy CreditAttribution: geerlingguy commentedI can confirm that the patch in #20 applies cleanly, adds in the "Organic Groups: Group" filter for views.
Please commit, so I can have an unpatched og install :D
Comment #26
Dp-Mtl CreditAttribution: Dp-Mtl commentedHi all, thank for patch. Patch #20 works for me very well!
My job is to assign tasks to the users in another group, and I need a users optionts made by views. At the begining I used user roles as a "filter", and assigned all users in some other group with some role, but it was proved not good. I need a "group" filter.
so I'm lucky here having a good patch.
I applied the pacth and I had filter such like "Organic groups: Group = some other group", So far so good!
I keep working with module very well with user admin. But when I finished all that, I found it did not work with other users. I knew it's so dificult to get through in short time. But finaly, I found out I was using module Spaces, and I found the permission "view users outside groups", that is just so simple!
Now every thing is perfect.
Comment #27
mrwhizkid CreditAttribution: mrwhizkid commentedThank you so much! A very useful patch and a useful filter. Just what I needed.
Comment #28
Rosamunda CreditAttribution: Rosamunda commentedPlease commit this VERY useful patch!!! :)
Comment #29
amitaibu1) Is this comment relevant?
2) Can't we just have
$this->value_options = og_all_groups_options();
Powered by Dreditor.
Comment #30
amitaibu1) Is this comment relevant?
2) Can't we just have
$this->value_options = og_all_groups_options();
Powered by Dreditor.
Comment #31
amitaibu1) Is this comment relevant?
2) Can't we just have
$this->value_options = og_all_groups_options();
Powered by Dreditor.
Comment #32
bschilt CreditAttribution: bschilt commentedHere is a new patch with the changes applied that @amitaibu suggested. Its essentially the same as the patch in #20. I've tested and it works well.
@amitaibu, can we get this committed to at least the dev branch soon? I'm doing some views integration work with the og_subgroups module and once this patch has been committed I can finish my work with subgroups by replacing the flat group select box with the subgroup hierarchy selector.
Comment #33
Jarada CreditAttribution: Jarada commented*Bump* Any progress on this commit?
Comment #34
afox CreditAttribution: afox commentedI've tested this patch with couple sites already with no problems. I think it definitely need to be committed! I'm marking it RTBC - if new issues rise up, create new topics.
Comment #35
geerlingguy CreditAttribution: geerlingguy commentedYes - please commit :-)
Comment #36
Sansui CreditAttribution: Sansui commentedVery cool patch, very similar to a filter I would like to have in OG.
However, instead of choosing from a static list of group options in the filter to filter for/against, I would like to be able to filter against the current group node provided by argument. Is it possible to use argument as a filter option?
Example use: Filtering out users that are members of the group node
Comment #37
mattgilbert CreditAttribution: mattgilbert commentedsubscribe
Comment #38
Grayside CreditAttribution: Grayside commented@Sansui we could add an option that uses the current group node from context.
Why does the patch add
'field' => 'nid',
to a seemingly unrelated handler?Comment #39
jeffschulerThis patch removes that
'field' => 'nid'
that Grayside refers to, which actually adds a spurious item to the fields list called "n", (in group "n" with description "n".) See attached screenshot.Comment #40
Grayside CreditAttribution: Grayside commentedCould someone describe the View for which this would be used? 5 minutes of poking around Views UI and I haven't seen it yet.
Help should end in a period.
Comment #41
Grayside CreditAttribution: Grayside commentedhttp://drupalcode.org/project/og.git/commit/3fc1e7d
Comment #43
Delty CreditAttribution: Delty commentedCould someone please check on this? As far as I can tell, this patch never actually got committed - the portion intended for og_views.views.inc isn't in the current dev at least.
Thanks,
-=Delty
Comment #44
HongPong CreditAttribution: HongPong commented*bump* yeah I think that the patch on #39 did not actually get in - not having luck filtering this way on a user view . The string "OG: Members that belong to a group" is not in og_views.views.inc .
Maybe I'm crazy but I don't find this stuff on 6.x dev og_views.views.inc:
Could someone review this?
Comment #45
soulfroysI checked in comment # 41 that has been committed only part of the patch in # 39 (the file og_views_handler_filter_og_uid_nid.inc only).
I created a new patch (against the last DEV) with the rest of the code and it worked as expected!
This is a great addition to this module! I hope I have contributed in some way... (Sorry for my bad English)
Comment #47
Grayside CreditAttribution: Grayside commentedhttp://drupalcode.org/project/og.git/commit/cb50af6
Ah, looks like a Git fail. Thanks for the patch!
Comment #49
sgtsaughter CreditAttribution: sgtsaughter commentedCan anyone explain how to configure this? I'm looking to have an exposed filter for a User View Type by the groups that the user is in (i.e. only show me users that belong to a selected group).
@Grayside, I'm not seeing the code in comment #47 in the latest version of og. Was it removed? I see from the release notes of 6.x-2.3 that it was added
but I don't see the code in there either.
Thanks.