1

I have an OG and a field that lists users with checkboxes. Is there a way using Rules, to add the selected users as group members when group is saved/updated?

3
  • I'm nowhere... I'm stuck at getting the values from the field that contains user . names Jul 12, 2017 at 13:27
  • Have a look at this answer, which IMO is a variation of what you're asking for. Does that help somehow? Jul 12, 2017 at 15:26
  • Looking at your answer it seems you made major progress as compared to your prior comment, well done! Did my hint (link) in my prior comment help you somehow to get it to work? Jul 12, 2017 at 20:49

1 Answer 1

1

This is the rule I created to solved it:

  1. After updating/adding existing content of type
  2. Entity has field Parameter: Entity: [node], Field: FIELD WITH UNAMES
  3. Crete a LOOP
  4. (In Loop) Subscribe user to group -- Parameter: User: [list-item], Group: [site:og-context--node]

Here is an export of my rule:

{ "rules_watch_list_group_add" : {
  "LABEL" : "Watch List Group Add",
  "PLUGIN" : "reaction rule",
  "OWNER" : "rules",
  "REQUIRES" : [ "rules", "og" ]
  "ON" : { "node_insert" : [], "node_update" : [] },
  "IF" : [
    { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_watch_list" } }
  ],
  "DO" : [
    { "LOOP" : {
        "USING" : { "list" : [ "node:field-watch-list" ] },
        "ITEM" : { "list_item" : "Current list item" },
        "DO" : [
          { "og_subcribe_user" : { "user" : [ "list-item" ], "group" : [ "site:og-context--node" ] } }
          ]
        }
      }
    ]
  }
}
2
  • This was the real answer... these are the four things I did to get it working Jul 12, 2017 at 20:18
  • Minor remark: bullet 1 seems to not match with your actual Rules Event ... Jul 12, 2017 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.