Rule to make all users of a role members of every group of a certain type (trigger up for grabs) in Rules 2

Events happening in the community are now at Drupal community events on www.drupal.org.
dddbbb's picture

Hi Folks.

In Rules 2, I'm trying to work out how to assign all users of a role (Manager) to be members of every OG group of a certain content type (Company). Ideally I'd like this to happen when ever a new 'Company' node is created but would settle for a cron based trigger if I have to.

Does anyone have any pointers as to how I might achieve this?

Triggering a rule on node creation and adding a condition to check the content type is pretty easy. It's the rest that I'm a little fuzzy on.

Any help would be greatly appreciated.

Comments

Try a User_Reference Field

Ashford's picture

Would it work to add a User Reference Field with multiple values to content_type Company? To make your Select List for that field you could use a View filtered by Users where Role=manager.

Event: after saving new content

Condition: content type = company

Action: Load referenced user (select the referenced field)
Action: Promote user to an Admin in the specified group (Use PHP to return the $node title as the group name)

In my rules, I have only used single values in the user_reference field, but maybe it will work. I am not a coder and I often find out later that there are easier ways to do things. I only offer this as a suggestion of what I would try.

Thanks for the suggestion. I

dddbbb's picture

Thanks for the suggestion. I might give that a try.

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: