Creating Fixed Expiration Date Membership Plans with Rules

Submitted by Leighton Whiting on Tue, 10/26/2010 - 17:07

This tutorial is an answer to the following forum post: http://www.moneyscripts.net/forums/feature-requests/2010/05/25/fixed-exp...

We are going to be illustrating some of the power that the Rules integration provides us. The use-case we are going to examine is the ability to create a membership plan that will have a 'fixed expiration date', meaning it will expire on a certain date, regardless of when it was created.

The first thing we need to do is create our Membership Plan. I am calling this one 'Trial Membership'.

The important thing here is to make sure that the plan is non-recurring, since recurring plans don't make much sense for a fixed-expiration date scenario. It doesn't matter what we set for the expiration date, since this will be changed later by the rule we make. I am setting it to not expire.

The next step is to create our rule. If you don't have Rules installed, go get it and install it: http://drupal.org/project/rules

The rule event we will want to act on is the "Membership Signup" event. This rule will have one purpose: Set the expiration date to December 31st. This translates into the following Rule Action, provided by Membership Suite:

The only thing we need to change is the Date, making it be the date we want the expiration to be.

We also want to make sure that this rule only applies when the user purchases the Trial Membership. So we need to add a condition. Add the "Membership Plan is equal to " condition:

Just make sure that "Trial Membership" is selected for the Plan Name.

Now we can save our Rule, and we are good to go! The rule should look like this:

Now we need to test the process to make sure it works. Go to user/register in a different browser, and try to register with the Trial Plan:

Now when you are logged in, go to My Account, then click the Membership tab. You should see the membership there with the expiration date set to Dec 31st.

Success!

Comments

Fixed Date Memberships

Hi,

So I'm guessing that the Rules instruction above is for Drupal 7 because my Rules is not organized that way.  I'm on Drupal 6.  I think I've figured out how to do it in 6, but instructions would be great.

 

I'm having one problem.  Setting this up with rules would require that someone change the date in rules every year.  My client is is no way capable of doing that.  Unfortunately, she is one of my last clients, because I will be going into a different business.

 

How can I set it up to annually adjust?  I tried to create a triggered rule that was specific by date.  

For example:

If payment or membership in 2012

then expire Dec. 31 2012

 

I'd just create 10 or so of those, from 2011 - 2021.

If payment or membership in 2013

then expire Dec. 31 2013

ETC.

But I can't find a way to select the payment or memberships by year.

 

Any suggestions?

Tamela

Unbelievable useful, thanks

Unbelievable useful, thanks so much Leighton!

Twitter Feed