When a user requests to join an Organic Group, I want to send an email to the group's admins. I've found this answer (https://stackoverflow.com/questions/16742925/how-to-send-an-email-to-drupal-7-organic-groups-role-members/23301910) which helps with selecting users with the appropriate role, but I can't for the life of me get a list of just the users from the current group.
You don't need any of that php stuff tenken is saying. Just install Rules, create a new rule reacting on a user joining a group and use the action "Get group members from group audience". For this to work, you'll have to add to the conditions in the rule that the node is in fact a group.
Sounds like you need to:
- define a new variable in your Rule called
- use a
php scriptstep to use an
EntityFieldQueryor Organic Groups API call to list the users in a Group.
$users_in_groupto the result of your php-script business logic.
- Use a
Rules Loopto loop over the result array of
- use a final
php-scriptrules step to do the logic you describe in your link for the appropriate user.