Subscribe a user to specific OG group using Rules
Last updated on
1 November 2016
Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites
The following export is from pandaPowder's comment in OG issues:
https://www.drupal.org/node/1944508#comment-7738077
Works with OG 7.x-2.7 and Rules 7.x-2.7
Use the Import function of Rules (http://domain.com/admin/config/workflow/rules/reaction/import)and paste the code below. You can then modify to your group name and ID.
{ "rules_start_first_course_on_create" : {
"LABEL" : "Start First Course on create",
"PLUGIN" : "reaction rule",
"TAGS" : [ "groups" ],
"REQUIRES" : [ "rules", "og" ],
"ON" : [ "user_insert" ],
"DO" : [
{ "variable_add" : {
"USING" : { "type" : "node", "value" : "71" },
"PROVIDE" : { "variable_added" : { "foundation_course" : "Foundation Course" } }
}
},
{ "og_subcribe_user" : { "user" : [ "account" ], "group" : [ "foundation-course" ] } }
]
}
}
This simple export helped tremendously because I was getting lost in the weeds of Rules and took me two days of Google-ing to find.
Help improve this page
Page status: No known problems
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion