I often get questions about how to set up member IDs in Participants Database. It is possible to use the built in “id” or “private_id” fields, but in most cases, you’ll want to be able to generate your member IDs yourself according to your desired format.
I am providing a working example plugin, which you can customize to your purpose, or use it as-is. It just assigns a number as the ID, and whenever a new record comes in, it gives it the next number.
You can change the part that assigns the new ID with your own formula for determining the member ID if you want to use a custom format.
Setting Up the Member ID Field
The member ID field needs to be set up in your Participants Database fields. You can set it as a “text-line” field or “numeric” if you just want consecutive numbers for your IDs. Configure it to be included in the signup form and marked as “read only.” The plugin code hides the field in the signup form so it can set the member ID in the background.
The ID field must be configured to be included in the signup form in order for the new ID value to be saved when the new record is saved.
I’m including a plugin that sets up a simple member ID field functionality: it starts with 1000 and then every new record added after that gets the next number in the sequence. You can easily adapt this to other kinds of member ID schemes if you know how to do that in php.
Download this plugin by clicking on the filename at the bottom of the code window. It will take you to a page where you can download the zip file. The zip file can be easily installed on your site by using the “Plugins/Add New” item in the admin, then clicking on the “Add New” button at the top of the page.
Be sure to edit the plugin file so that the $id_field variable has the name of your Member ID field.
This plugin will also automatically add a member ID to records that don’t have one when they are updated.