Int3c

UX, Design and Product Development Services

More Flexibility for Flags: Using Flag Limiter to create simple registration and signup

Flag limiter allows you to put limits on any flag in your Drupal site.

Like Views or Rules modules, flag module is one of my favorite, general purpose Drupal modules. Flag module let’s you create a customizable system of “flags” for things like bookmarks, important content, friends, flag as offensive or whatever. With great Views and Rules integration, it’s a powerful combination for site builders.

Flag Limiter builds upon version 3.x of Flag module (which allows fields on flags!) to enable you to add limits on the the total number of flags per entity or node as well as a limit per user of that particular flag. So, for example, you could limit one page to be flagged up to 15 times and limit individual users to only 2 flags of that type.

In the spirit of Drupal flexibility, this allows for some interesting usages. For example as an alternative voting system, a simple user promotional method, or as a simple signup or registration method.

In this post, I’d like to present how to setup Flag Limiter and specifically how to use flag limits to create an alternative signup or registration method.

How to Install and Setup Flag Limiter Module

In order to use Flag Limiter, you’ll also need the 3.x release of Flag module. You’ll need to install and enable both of these modules. Once installed, you’ll need to create an initial flag.

After you’ve installed the modules and created your flag, setting up flag limits is quite simple. Go to the flag settings under Structure > Flags, then select the flag you wish to work on and click “edit.” From there you’ll be able to see the tab for “Limiter” which is where you can customize different settings on each flag.

As you can see from the screenshot above, there are two settings you can change:

  1. total number of flags per user
  2. total number of flag per individual node or entity page

Finally, it should be noted that there is a setting for hiding flag links once the limit has been reached.

That’s basically it. Now let’s look at a real-life example involving a simple registration system on RTConvetion.com’s conference site.

Simple Registration System for Author Appearance Signups

While we work a lot on [conference registration websites]( # LINK HERE #) and generally love and use Entity Registration module to handle most of the registration work, we decided that this module was a bit too heavy, required too many confusing steps and was not quite as flexible as we needed for a recent site build.

RTConvention.com is a great example of how to use Drupal to accomplish your site-specific goals. They run a large yearly conference for writers and readers of Romance fiction. They have a growing a passionate customer basis and have multiple websites serving their users in different ways.

In past years, from their conference registration, they’ve used Ubercart and signup modules but this year we used Drupal Commerce to handle all of the e-commerce work for the registration and for all of the promotional sales. We wrote small customizations for various specific products in order to create specific sales pages on speciality items. We used Views and basic flag module to allow users to create a dynamic schedule of events they want to attend.

But when it came time to allow authors to signup for their author appearances, we ran into a problem. RTConvention needed a way for authors to signup for appearance times but each slot needed to be limited to 15 total signups and 2 total signups per user. While Registration module is great for handling the signup and registration collection of each attendee, it wasn’t quite flexible enough for our use case. Viola Flag Limiters.

With Flag and Flag Limiter modules, this task was actually pretty straightforward. Here is the basic recipe:

  1. Author Appearance content type: This was just a normal node content type with a date time field

  2. Author Appearance flag: We customized the link text slightly to make the usage more understandable to authors and limited the flag to only the “author” role.

  3. Flag Limits: For the flag limits, we limited it to 15 total per node and 2 total per user, as specified in the original request.

  4. View page: We used views to create several views page, including the basic signup page for authors, a total signup count report for admin and finally the public page showing which authors would be appearing during which time slots.

Take a look at a sample of the final result:

Conclusion:

As you can see from the installation and setup guide above, Flag Limiter is a simple and straightforward module. It allows non-technical users to put limits of flag and, in turn, create custom usages and displays using Views and Rules modules.

Thanks to the wonderful folks at RTConvention for sponsoring this work. Please post any module problems or issues in the project issue queue.

NOTE: It’s worth admitting that there was already at least one other module ((Flag Limit)[https://drupal.org/project/flag_limit]) proposing this same functionality. Unfortunately at the time of development and now writing, this module was not working. We hope to (merge efforts in the future)[https://drupal.org/comment/8229585#comment-8229585].

Mark Koester Mark has worked on Drupal since the early days of D6. He is passionate about open source as well as entrepreneurship. When he isn't building, he enjoys traveling and speaking one of his many foreign languages. Chengdu, China

Latest Blog Posts

Ever needed to trim text to fit the height of an area? Shave Module for Drupal helps you do this intelligently by allowing you to truncate text to fit within an html element.

Wouldn’t it be cool if you could use Rules to periodically set, change or modify certain Drupal site configurations and variables?

Yeah, it would be cool and nowit is totally do-able with "Rules Set Site Variables”

Wouldn’t it be cool if you could use Drupal Rules to set, change or modify certain site configurations and variables? Yes, it would be awesome and now it is possible with "Rules Set Site Variables” module.