Automatically Generate Barcodes for Users on a Drupal Site
Tags: DrupalDrupal PlanetDrupal ModulesPythonWhat is the problem?
As a conference organizer for a few of Florida's past DrupalCamps, and an attendee of many other conferences, I've noticed a huge bottleneck during the attendee registration process the day of the conferences.
Organizations like to account for attendance, and often a group of volunteers assume the daunting task of asking an attendee their name, finding this name on a multi-page spreadsheet, finding the attendees pre-printed badge, and then handing them their swag-bag.
Quite a few commercial applications exist, but they aren't open source or free.
There are also online services like Eventbrite, but you don't own your data and they also can have fees attached to them. They also depend on wifi, which may or may not be available at the conference.
How do we solve this?
This is a two-step process:
- Accounting for Attendees the day of the conference.
- Generating a method to assign attendees barcodes.
Accounting for attendees.
I started the brzr, (pronounced breezer), project to handle the accounting of attendance the day of the event. brzr isn't Drupal specific and can be used with any system as long as you can create barcodes for the attendees.
It is an Apache 2.0 licensed, free and open source project that uses an inexpensive barcode scanner to scan attendee barcodes and store them in a SQLite database. I got my test scanner for $25.00. Everything is stored locally and it doesn't require an internet connection to work.
There is much more detailed documentation in the README on the brzr project page.
You can use it on any operating system that you can install Python on, including Windows, Mac, and Linux.
I plan on using it with a Raspberry Pi, I've included support for attaching an LCD display to the Raspberry Pi, so you don't even need a monitor on the already cluttered registration table. The Raspberry Pi costs about $35.00.
Now we have a way to quickly check attendees in the day of the conference. Scanning a barcode takes approximately one second with my scanner.
Creating the barcodes.
Hopefully this will speed up some of the process, but the second step is getting barcodes on attendee badges and asking them to bring these barcodes with them the day of the event.
This way, a volunteer can quickly check them in by scanning their barcode.
If we can get half of the attendees to do this, it will greatly speed up the check-in process. For my particular conference, I'm going to email them a reminder with their barcode before the conference and ask them to print it out and bring it with them.
Maybe the awesome volunteers might get to eat breakfast before the conference starts!
Configure your site.
Now we need a way to assign a unique number to their barcodes. Obviously this a Drupal related post, and because I am using a Drupal site for the conference site, I've come up with a Drupal solution.
We're already storing attendee data in the site, since they've registered an account and signed up for the event.
Using a few contributed modules, I'll outline the steps to generate barcodes and attach them to their user profiles. These barcodes correlate to their user id, which is unique on the Drupal 7 site.
I'll outline the steps I took to get this working now. First, you'll need need three additional modules:
- barcode
- Note: As of the writing of this post, you'll need to apply this patch from the barcode issue que to use token support to supply a value to the barcode from entities other than nodes. If you don't know how to do this, check out the documention from drupal.org.
- field_permissions
- We don't want users changing or creating their own barcodes, since we need to correlate them with a known value later to account for their attendance, so we'll use field_permissions to prevent them from editing this field in their profile.
- token
- This allows us to supply a default value containing the user's id for the barcode field.
Download and enable these modules, and be sure to apply the patch to the barcode module.
Now, add a barcode field to the user profile. Choose the codabar style for your barcode. This gives you the most flexibility with character counts and formatting. Make sure you supply a default value for this, otherwise it will end up blank.
If you're using the Drupal user id like me, use the token A[user:uid]A
. The letters in front of the token are arbitrary, but you'll need to supply something. The codabar format requires a start and stop character, and that is what those letters are for. You can pick any letter you want, and even correlate them to a code for your conference if you like.
Now set the permissions on the field to prevent the user from editing this field. If you plan on requesting users to print their barcodes, set the permission to allow them to view this field.
Users can view their profile after registering for an account on the site and print their barcodes.
You can use the views module to show and sort the attendee badges as well for those that don't bring their barcode with them that day.
One caveat is that the unique barcode is generated at the time the account is created. This method won't work for users that already exist. You'll need to manually edit their profiles or write some code to this all of this for you.