SQL code to add plan name from Membership Pro into your EB Registration data

  • David Unwin
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
2 years 1 hour ago #157804 by David Unwin
If you use Membership Pro in conjunction with Events Booking, you might find the following useful if you do offline analysis of your event bookings.

For all our events, our members get different discounts depending on their membership plan for entry to our events.
It has not been easy in the past for us to download our event registration records and analyse them to see which groups of members came to our events. We could only base it on things like name of the person or the discounts we gave. What we really wanted to do was look at which membership plans were being used the most on our events booking.

Just to give you some background. Every user who registered on our site gets registered in our Membership Pro with a 'free' registration plan, in our case we  named it 'Registered' If the user then pays for a plan, we allocate that user to to the plan and expiry them from the free 'Registered' plan. When the plan expires, the reverse happens. If the user then renews their membership or buys a different one we start over again.

So what we have done is to create an Event Custom field for events we want to analyse. We used an custom field type of SQL. When a registed user logs into our web site and books an event the SQL gets the Title of the Plan the user is member of and stores that in the Registration record. Then when we download registration records we can do the analysis by Membership Pro Plan. Some points to consider.

1. The Plan Title will only be filled in if the user is logged in and has an 'active' membership, If the membership has expired, it will be blank or if the user does not have a membership or has not logged in before making the booking,  the field will be blank.

2. The field on the booking form shows as a drop down, if the user has a membership plan, it will show the plan Title  otherwise bBlank. As the user cannot enter anything in this field, I used a css class to hide the field so as not to confuse people.

3. As it is a SQL field you cannot set a default, so the field will always bet empty if the user does not have an active membership plan.

I have attached the SQL code and a couple of screen shots in the zip file to show you how it works.

Finally, I could not have done this without the help of Tuan, who wrote and gave me the SQL code. My thanks to him for helping me acheive this nice little extra feature.
Attachments:

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #157808 by Tuan Pham Ngoc
Thanks David for sharing the solution here. It might be helpful for other customers who has same requirement

Regards,

Tuan

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc