How to subscribe a user to a group after completing the checkout process?

I´ve tried this: http://drupal.org/node/1416742#comment-6124082 and didn´t worked out.

Is there a way to set manually a group using the group NID?
Like after Completing the checkout process
and Order contains a particular product
Create a new [user] entity ...
Loop: Add user role ...
Until there I get the rule working smoothly.
I would like to add to it: Add user to group where NID of the group is: X (an arbitrary node number, which is a group nodetype)

Maybe this could be done with some php? How?



Posted: Mar 15, 2013


sportel on November 15, 2013

Hi all,

I'm also looking for a way to subscribe a customer to a Organic Group. My set-up is a little bit different from what S1L describes in his tutorial, but I'm hoping that your experience on this subject can help me.

When I add a new (commerce) product, a product display (node) is automatically created (I've created a rule to accomplish this). This product display is also an Organic Group. So when a customer orders a product (and has paid the order in full) he has to be subscribed to the related product display (= group).

So, the event will be: When an order is first paid in full.
The action will be: Subscribe user to group (user = commerce-order:owner)

But now I need the group (to subscribe the user to) to bring into focus, and I can't figure out how to do this. There has to be a way, isn't there?
I hope someone can help.

edit: I don't know if this helps: the product display title is always the same as the related commerce product title, and both are always unique.