I'm creating a rule for recording a message about posting a comment on a node within a group. My goal is to populate the groups reference field on the message by doing a "Set data value" to the groups reference field based on the groups that contain the node on which the comment was posted.

This would be straightforward if I were writing code to do this, but I'm getting a bit lost with when I try to use the Rules UI to get from the Comment to the node groups and set data based on this value.

A) My first thought was that I could do set data value and use a comment:node:node groups or similar data selector, no selector appears to exist that would et me from comment=>node=>node groups. Should I write that integration? Or

B) Would it make more sense to write an action such as "Get node groups" to determine the groups that a node is posted into, somewhat analogous to the “Get group content from a group” action?

Any input here would be appreciated. Thanks!

Comments

amitaibu’s picture

Let me step back a bit -- is Rules a hard dependency? What will you gain from using it?

ezra-g’s picture

My motivation for building Message integrations via Rules is that it provides more configurability and overridability of Message logic for site builders using the Commons distribution.

While it may take more time to initially write integrations via Rules versus hard-coding them, it would be harder with a hard-coded integration to provide overridability of Message logic.

ezra-g’s picture

Title: Using Rules for Comment in Group messages » Rules integration for groups associated with a comment
Category: support » feature

Retitling this as a feature request.

ezra-g’s picture

Status: Active » Closed (won't fix)

After deeper investigation, I'm not sure what I was proposing here is actually a good idea ;).

Since the node might change its group membership after the message is generated, it's likely better to store only the nid in the message, and join against the OG Visibility of that note.