1

I used this tutorial for creating a membership with Drupal Commerce which works well.

How I can set membership expiration?

I know I should use Rules, but I do not know how.

1

If your "membership" is already implemented as a role, you could use the Commerce License module (the Commerce License Role submodule). In the UI, licenses can be assigned to have default lengths that will automatically be set upon purchase; if you need to change lengths, you can also configure rules to do so.

0

I have been working on this too. What I did was add a field to the user object (config>>accounts>>managefields). The field I added was a date field, and I called it premium_until. You will also want to make sure that the user cant change this field. I used the field permissions module to accomplish this.

Then I made a rule to add a month to that field whenever a user bought a 1monthsubscription product.

Then I made 2 rules to run at login. If the current date is before that date and the user is not premium, then make them premium .... and conversly, if the current date is after that date and the user is premium, then take premium away.

Let me know if you want more details and I can dig up the exact rules I used.

  • Hi, thanks Please more explain about rules Have used. – alireza Dec 1 '12 at 8:25
0

You can use the Membership Entity modules which handle this automatically.

They create a separate entity for the Membership so it can be managed distinctly from the User. Expiration is handled automatically. The modules also handle renewals and grace periods, and are integrated with Commerce so if you are selling your membership a Product Type is automatically created.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.