At the moment is is only possible to check whether a user is member of a certain group. In some cases it is very useful to have conditions for verifying that a certain entity (group content) belongs to a group.
The patch adds such a condition and a more generic function implementation for checking the condition.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amitaibu’s picture

Status: Needs review » Fixed

Committed, 10x

mh86’s picture

Status: Fixed » Needs review
FileSize
342 bytes

In my last patch I forgot to add a 'wrapped' => TRUE to the og_user_in_group condition. Without that, using this condition leads to an error.

amitaibu’s picture

Status: Needs review » Fixed

Committed, thanks.

fago’s picture

Status: Fixed » Needs review
FileSize
1.91 KB

That's a great addition. Here is a follow-up though, which unifies the action labels with the condition labels and removes the states parameter for the condition, which imho only makes sense fore users.

amitaibu’s picture

Status: Needs review » Fixed

Makes sense, committed.

Status: Fixed » Closed (fixed)

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

mh86’s picture

Status: Closed (fixed) » Needs review
FileSize
1.06 KB

another follow-up. patch from #4 broke the 'entity in group' condition, as some internal Rules parameters were passed for $states. Using named parameters instead is an option, but as both conditions use different parameter names, it gets ugly again. Thus I split up the conditions into two separate functions.

And seems like we should start writing some tests for it, as we broke the Rules integration quite often with some new patches in the last time ;)

amitaibu’s picture

> And seems like we should start writing some tests for it

I'd be very happy to commit such a test, but I'm not familiar enough with Rules' internal to write tests for it -- @mh86, do you think you can do it?

amitaibu’s picture

Status: Needs review » Needs work

Committed, thanks. Moving to needs work to add tests...

  • 0756d82 committed on 8.x-1.x
    Issue #1272850 by mh86: Added Rules condition for checking if an entity...
  • amitaibu committed 1ba2d4d on 8.x-1.x authored by mh86
    Issue #1272850 by mh86: Fix og_user_in_group() for user entity.
    
    
  • amitaibu committed 351f190 on 8.x-1.x
    #1272850 follow up by mh86: Added Rules condition for checking if an...
  • amitaibu committed 8c02992 on 8.x-1.x authored by fago
    follow up on Issue #1272850 by fago: Remove states option form from...