2

I want to create a rule that sends an email to all users of an organic group when content is posted to that group. In the email I want the name of the group to appear in the subject. I'm completely lost. How can this be accomplished?

1

You can use the token [node:group-audience] to add the group name in your email notification.

Here is the export of the rule I am using:

{ "rules_og_group_content_notification" : {
    "LABEL" : "OG group content notification",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "og", "rules" ],
    "ON" : { "node_insert" : [] },
    "IF" : [ { "og_entity_is_group_content" : { "entity" : [ "node" ] } } ],
    "DO" : [
      { "og_get_members" : {
          "USING" : { "group_content" : [ "node" ] },
          "PROVIDE" : { "group_members" : { "group_members" : "List of group members" } }
        }
      },
      { "LOOP" : {
          "USING" : { "list" : [ "group-members" ] },
          "ITEM" : { "list_item" : "Current list item" },
          "DO" : [
            { "mail" : {
                "to" : [ "list-item:mail" ],
                "subject" : "New [node:content-type] in [node:group-audience]",
                "message" : "Hello [list-item:name],\r\n\r\nThere is a new [node:content-type] called [node:title] that belongs to [node:group-audience]: [node:url]\r\n\r\n\r\n--\r\n",
                "from" : [ "" ],
                "language" : [ "" ]
              }
            }
          ]
        }
      }
    ]
  }
}
0

I was not able to use the placeholder [node:group-audience] in my setup for some reason. However the placeholder [node:og-group-ref] did the trick.

To answer the rest of this two-years old question, here is a screenshot of the required rules configuration:

Rules configuration for group content creation notification

To provide the group name in the mail add the placeholder [node:og-group-ref] in the subject:

Rules placeholder configuration for group name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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