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.
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.
Comment | File | Size | Author |
---|---|---|---|
#7 | og_rules_entity_in_group.patch | 1.06 KB | mh86 |
#4 | og_rules_fix.patch | 1.91 KB | fago |
#2 | og_rules_cond_user_wrapped.patch | 342 bytes | mh86 |
og_rules_cond_entity_in_group.patch | 1.92 KB | mh86 | |
Comments
Comment #1
amitaibuCommitted, 10x
Comment #2
mh86 CreditAttribution: mh86 commentedIn 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.
Comment #3
amitaibuCommitted, thanks.
Comment #4
fagoThat'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.
Comment #5
amitaibuMakes sense, committed.
Comment #7
mh86 CreditAttribution: mh86 commentedanother 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 ;)
Comment #8
amitaibu> 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?
Comment #9
amitaibuCommitted, thanks. Moving to needs work to add tests...