As referenced in #602754: Add "Manager of the current group" to Group nodes validator it makes sense to include node type filtering in the Group nodes validator.

As stated in og_views_plugin_argument_validate_og_group_types.inc, the Group nodes validator already borrows heavily from the Node validator (and for good reason). This feature will ensure that we don't have to choose between the Node validator and the Group nodes validator.

One use case for this is to allow a view to be written for one or more group node types, but not for all group node types.

A patch for this will be coming soon.

Comments

marcp’s picture

Status: Active » Needs review
StatusFileSize
new4.16 KB

Here's the patch.

It adds a group of checkboxes -- one for each group node type -- to the Validator Options for the Group nodes argument validator. The help text for the checkboxes explains it this way:

If you wish to validate for specific group node types, check them; if none are checked, all group nodes will pass.

This is similar to the way the Node validator explains what its checkboxes do.

There is no need for an update function -- this is fully backwards compatible as no selection retains the previous functionality of checking to make sure that the argument represents a group node.

marcp’s picture

To apply the patch, put it in sites/all/modules/og and:

   patch -p 0 < og-issue-639294.patch
bonobo’s picture

This is working well for us in our dev environment.

izmeez’s picture

subscribing, I have been trying to configure an argument to do exactly this, apply to specific group type, http://drupal.org/node/638058

I will give this patch a try.

izmeez’s picture

sorry, my dev environment isn't to the point of running patches and I was hoping to be able to do this fast manually.

I am trying to apply to og 6.x-2.0 and can't seem to get my bearings with the patch. I had a quick look at the files in og 6.x-2.x-dev but still having problems. I must be missing something simple. Any help would be appreciated. Thanks.

izmeez’s picture

Sorry to be a pest. I am very new to applying patches in Drupal and would appreciate any help.

I used a patch utility in WinOS to apply the patch to og 6.x-2.0 and it is not working. I am getting a .rej file. I do not know what I am supposed to make of this file. I am attaching it in case someone can suggest to me what I should try next. I would really like to use this patch.

Thanks,

Izzy

marcp’s picture

Are you applying the patch on 6.x-2.x-dev version of the codebase?

I'm attaching as a text file the one file -- modules/og_views/includes/og_views_plugin_argument_validate_og_group_types.inc -- that the patch modifies. Replace your copy of og_views_plugin_argument_validate_og_group_types.inc with this one in the appropriate place.

izmeez’s picture

Thanks for the quick response.

No, I was not applying it to the dev version. I looked at the og_views_plugin_argument_validate_og_group_types.inc file in both og 6.x-2.0 and og 6.x-2.x and they looked identical.

Thanks for the file attachment. Do I need to apply the patch to this file?

Izzy

marcp’s picture

Nope, that's the already patched file.

izmeez’s picture

Thanks, I thought so and have run tests and it works great. I also like the additions in the validator to choose if the user is a member of the group or an admin or neither. This patch is very useful.

Izzy

marcp’s picture

@izmeez - As a member of the community, you should feel free to set the status of this thing to reviewed & tested by the community. I'd do it, but I submitted the patch.

izmeez’s picture

Status: Needs review » Reviewed & tested by the community

I have tested the patch with og 6.x-2.0 and it seems to work great.

I will go ahead and change the status of the issue to reviewed by community but had previously held off because I thought it needed to reach a certain threshold to qualify for that status.

Thanks again for this very useful patch. I would suggest this should be committed to og as soon as possible as it is a feature that is fundamental to configuring the module.

Izzy

izmeez’s picture

OT: Sorry to use so much bandwidth, but I wondered about changing the title of the issue to "Group type validation for Group nodes validator" ?

I didn't change it because I find it can be confusing when others change titles of posts, so I would rather leave that to whoever started the thread or someone with a fully understanding if they think it's even worthwhile.

bonobo’s picture

Title: Node type validation for Group nodes validator » More granular argument validation for OG Group Nodes

Changing title --

Also, to reiterate from above: this has been working flawlessly for us.

bonobo’s picture

Hello!

Any feedback on this?

This is in place, working well, and has been perfectly stable.

It allows you to be much more flexible in creating different options for group types.

izmeez’s picture

Not sure what feedback you are looking for.

I agree this is a VERY useful addition to og_views and seems to be totally stable on OG 2.0

As a novice Drupal user I'm not really clear on the next steps.

Does this patch need to be committed to the dev release so it can become part of the next release?

My quick encounter with the dev release a couple of weeks ago seemed to cause some hiccups. Unfortunately, I was too pressed for time to explore why and reverted to og 6.x-2.0

I appreciate there are efforts to address a number of the issues in the og queue for the next release and issues with views.

It would be great to see this patch in og. Meanwhile, others can apply it or use the zip file.

I'll have to find some time to test out the current og dev again soon.

Izzy

marcp’s picture

Wondering if this has a chance to get committed. Should bonobo draw up some more pretty pictures?

bonobo’s picture

Did somebody ask for pretty pictures? Sweet! I'd love to!

The screenshot below shows what is added by this patch:

group_node_types

So, using the options shown with this patch, and the options shown in the screenshot below--

group_membership_validation

-- it is possible to show different views, for different group types, to different users based on their group membership.

To break this down into a practical use case:

Let's say a school has classes and clubs set up as group types. The person running the site wants people who manage classes to be able to email users and reset their passwords; however, all people in clubs should only be able to email members from that club.

Using this patch (in conjunction with Views Bulk Operations), this type of functionality becomes possible, and group admins/members can be given very targeted rights based on membership in a group.

marcp’s picture

Wondering if this has a shot. I'm getting ready to submit a patch for another useful feature and was hoping it could count on this one being committed.

moshe weitzman’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thanks for your patience and persistence and pictures.

amitaibu’s picture

Status: Fixed » Needs work

It's almost there - marcp can you please add some PHPdocs to validate_group_node_type()

[edit: seems to cross post with Moshe. A follow up patch on the docs with be still nice :) ]

marcp’s picture

StatusFileSize
new1.61 KB

@Amitaibu - Here are the PHPdocs for both of the undocumented helper functions in there. Always a good idea to include some documentation!

marcp’s picture

Status: Needs work » Needs review
moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community
bonobo’s picture

Is this committed?

If not, what additional feedback/review is needed?

bonobo’s picture

And btw, I was referring to the PHPdocs in #22 --

izmeez’s picture

I was doing some house cleaning and noticed that the status of this ticket has not changed but the feature was committed on December 15, 2009 and is in OG 2.1

Should this issue status be changed to "fixed" or "closed" ?

Thanks.

amitaibu’s picture

Status: Reviewed & tested by the community » Fixed

Committed docs, thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.