How to loop over a list of Organic Group users using Rules
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.