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.
Hello
I'm a bit unaware of a rules integration. Has this been partially implemented?
Some possible use cases:
- create any kind of rule to affect groups or their content
- cycle through groups and send email, update content, etc (via views_rules)
- Import groups from LDAP server (via rules + views + feeds)
Comments
Comment #2
kristiaanvandeneyndeThe module already supports Rules as far as Rules works with entities provided by Entity API.
Meaning you can already use Rules to:
What hasn't been done yet is custom Rules actions or conditions. Seeing as 90%+ of Group is pure Entity API CRUD-operations, there has been no custom Rules code yet given how much you can already accomplish out-of-the-box.
Useful Rules we may add could be:
Comment #3
lpalgarvio CreditAttribution: lpalgarvio commentedthat's great :)
when i have the chance i will explore these.
Comment #4
shas3n CreditAttribution: shas3n commentedRules integration will be really welcome!
Currently this is what I am trying to achieve with rule (and failing): When a group gets updated, the roles of all members should change based on a field value of the group.
I am trying to sell different kinds of groups (same group type, but different value on a list field) and the permissions for all users within this group will be different based on the value on the parent group's list field.
I was hoping to achieve this by defining different roles within the group and assign all users the roles based on the value of the field in the parent node.
Comment #5
kristiaanvandeneyndeTry this component to get you started:
Comment #6
shas3n CreditAttribution: shas3n commentedWoW! That was blazing fast!
Unfortunately I could not import the component in 7.x-1.0-beta6 or 7.x-1.0-beta6+8dev
I get error
Integrity check for the imported configuration failed. Error message: Data selector <em class="placeholder">group-membership:role</em> for parameter <em class="placeholder">list</em> is invalid..
I directly tried to import a component with the Rules UI. Am I doing something wrong?
Comment #7
kristiaanvandeneyndeDid you enable Entity Token? If so, try clearing caches.
Comment #8
shas3n CreditAttribution: shas3n commentedEntity tokens was enabled. Clearing cache did not help either. I am on Rule 7.x-2.9. I will try again after sometime.
Thanks again for your quick help.
Comment #9
kristiaanvandeneyndeLooking at your error more closely, I don't know why it says "group-membership:role" as it should clearly be group-membership:roles as shown in my export. If it still doesn't work, you should open a support request as this issue is getting derailed.
Comment #10
shas3n CreditAttribution: shas3n commentedI will open a new issue. [The roles->role was something with my own fiddling. The error is reappears with 'roles' too].
Comment #11
Rustan CreditAttribution: Rustan commentedWhen trying to import #5 I get the same error as #6, using current dev:
Integrity check for the imported configuration failed. Error message: Data selector <em class="placeholder">group-membership:roles</em> for parameter <em class="placeholder">list</em> is invalid..
Comment #12
kristiaanvandeneyndeHi, it looks like this is a bug in Rules.
I just tried to import the rule myself and got the same error. When I remove the offending action from the loop, I can import the rule just fine and add the action back in manually. So it really seems like Rules chokes on importing a component which manipulates data in a loop.
It could be worth browsing through https://www.drupal.org/project/issues/rules?text=import+loop&status=All
Closing this particular issue as fixed for the time being, unless it turns out to be a Group issue after all. Even though I really doubt it is.
Try importing the rule below and then manually adding the final piece to the loop:
Comment #13
Rustan CreditAttribution: Rustan commentedImporting the component in #12 works fine. I was trying this out while trying to solve another issue, cannot comment on how well it works for #4.
Comment #15
Pierre.Vriens CreditAttribution: Pierre.Vriens at In Petto commentedAs a followup to the bullet "E-mail all members of a Group, optionally filtered by GroupRole" in comment #2, have a look at the answer to "How to send an email to all members of a group after the group is flagged?". The Rule and Rules Component include there are pretty close to what's needed: using a flag (to trigger the Rule), an eMail is deivered to all group members. The only thing it doesn't do is to filter it by some GroupRole, which you can do by simply adding that as an extra Rules Condition in the Rues Component.