Skip to main content

NationBuilder users looking to boost membership sales have a new tool available to them in the form of event tickets. cStreet Campaigns has developed a method to limit event ticket access to people with specific active memberships. This could mean discounted tickets for members or VIP access for specific membership types, for example.

This blog post is brought to you by Alex Flint who is a Lead Developer at cStreet Campaigns - a certified Agency based in Toronto. Be sure to visit their website and see their previous NationBuilder work.

Our approach has three steps to it and requires some theme customization as well as a specific page setup.

Let’s start with the page setup.

When creating an event page and adding tickets in NationBuilder, your options are limited. However, our Creative Director and master NationBuilder hacker Amy Stuart, came up with a really clever solution.

When creating your ticket simply append |members:<membership name> to the end of it. This dictates which membership level will be able to purchase this particular ticket. We'll see how it's used in a bit.


Now we just have to write the Liquid code to parse this information and apply it. The first step of the theme customization is to know what active membership(s) a person has.

Thanks to NationBuilder’s new Liquid membership variables you have access to all of a person’s active memberships. Previously, this only returned a person’s oldest membership, which was less useful. To account for folks having multiple active memberships, we’ve built a Liquid loop that creates an array of sorts:

{% assign memberships = '' %}
{% for membership in current_signup.memberships %}
{% assign memberships = memberships | concat: membership.membership_type_name | concat: ", " %}
{% endfor %}
{% assign memberships = memberships | downcase %}

Now we have the variable memberships which contains a comma separated list of the person’s current active memberships. I recommend putting this in a partial (something like _membership_array.html) so you can include it in other pages without repeating any code.

The next step is in the event page templates, probably both regular and wide. You need a for loop that goes through each ticket level in page.event.ticket_levels and determines a few things:

  • Whether that ticket is limited to members only.
  • What membership level is needed to access it.
  • Whether or not the person has that membership level.

Let’s walk through this code together. I’ve added comments (the stuff between <!-- and -->) to the code, to help describe what's happening.  

So there you have it, you can now limit event tickets by membership type, like we did on this customer's website.


I’d love to hear what you’re doing with NationBuilder’s new membership liquid variables! Leave your comments below!

Share this post