Posted on by

“Multiple Databases” with Participants Database

One of the most frequent support requests I receive for the plugin is: can it do multiple databases? Can multiple instances of the plugin be installed? To both questions, the answer is no, it’s not designed for that, but you can do a lot with this plugin and in most cases it’s not really necessary to have separate databases. All that’s needed is a way to differentiate more than one kind of record.

First of all, any kind of website that needs something like this is probably going to have complex functionality. It is not the kind of website that can be put together by installing a few plugins. It will require a good understanding of the user experience, how to help people interact with the site so it’s not confusing, and it’s going to require some knowledge of HTML, CSS and PHP.

The purpose of this article is to outline the task so you’ll have a better idea what’s involved and then you can determine whether you need to bring in coding help or not. The example I give later on in the article is simplified, and wouldn’t require any coding, but many real-world applications won’t be this simple.

Is Participants Database Enough for the Job?

When people ask about multiple databases, they usually have two or three different classes of thing they want to store in the database. In some cases one of those things would be better handled by another plugin or functionality.

For instance, let’s say you have some people signing up for a newsletter and some people offering their time as a volunteer. Participants Database is not well suited to managing a mailing list, so you would likely be better off using a newsletter plugin for your newsletter subscribers, and Participants Database for your volunteers: it’s much better suited for that. You may need to figure out how to handle it when a person wants to both volunteer and subscribe to the newsletter, but that will be a lot easier than trying to customize Participants Database to handle a mailing list.

Another common thing people want Participants Database to do is register users, then let those users do things like post messages or ads. In this case, you’re much better off creating a custom role and registering your users with your website as WordPress users, then letting your logged-in users post ads or whatever you are having them do to interact with Participants Database. Once again, no need for multiple databases there, and I’ve written an article describing how to do that: Using Participants Database with WordPress Users

Simulating Multiple Databases

In those cases where you have different, but similar things to store in the database, the Participants Database plugin can handle that pretty easily. That is done by setting up a field that is used to differentiate your records as being a member of a class. Let me show you one way to do that…

In this example, fairly typical of the kind of thing plugin users ask about, there is a kid’s sports team that expects the parents to be involved in various ways. You want the kids to sign up and give the needed info for their participation, but you’ll have a different set of questions for the parents. This means we have a page for the kids to sign up and another page where the parents sign up.

The key to this is a field that differentiates the records. For this, we create a field named “type” that will indicate whether the record is for a team member or a parent. Make this field a hidden field and set the default value to post->post_name. What this will do is record the name of the page the signup form was on. With that, you’ll be able to tell which form was used to create the record.

Setting up the Signup Forms

An easy way to manage your fields is with field groups. Since some of the fields for both the parents’ and kids’ records will be the same, it’s convenient to group those together…things like name, address, phone number, email address…and, importantly, our “type” field. We’ll call this group “contact.”

Now, we create two more groups for the rest of the questions: one for the kids and one for the parents. The kids one would have things like t-shirt size, left- or right-handed, preferred position, experience, etc. We’ll call that group “player.” For parents it’s things like how they’re willing to help, when they’re available, and who their kids are.

Now that the groups are defined, we can set up the signup forms. For the kids’ page, put something like this:

[pdb_signup groups="contact,player"]

For the parents, it’s

[pdb_signup groups="contact,parent"]

Pretty simple, huh? We now have two different signup forms.

This article provides some more detail in setting this up: Using Multiple Registration Forms

Administration

Maybe you need to be able to add administrative notes to the records, too. You can put those into another group, “administrative” that holds things like the payers status (active, pending, inactive). Keep the “display” checkbox unchecked on this group so it’s not shown on the website. You’ll be able to edit these fields in the admin.

Showing the Team Roster

Once you have the records, you can do different things with them depending on the type. For instance, to show the current team roster, you could use a shortcode like this:

[pdb_list filter="type=kids-signup&status=active"]

As you may have guessed, the page where the kids signup form is has the name (slug) “kids-signup.”

At this point, you have your basic working setup, and I’ve demonstrated the general idea behind getting the effect of multiple databases out of the one database that Participants Database uses. You can extend this idea to many different applications.

Showing the Record Detail for Different Types

You can set up a custom template that will show the single record differently based on what kind of record it is. This code shows a special single record template that chooses which shortcode to use based on the “type” value in the record:

You can also set up a record update form that will present different fields depending on the type: see the link below for instructions on setting that up.

Using Multiple Registration Forms

Here is an article that explains how to show a record edit form based on the type of record: Showing a Record Edit Form Based on a Value in the Record

61 thoughts on ““Multiple Databases” with Participants Database

  1. How to exclude some fields from the Single Record Page [pdb_single]?

    In my form I have the fields “name”, “address”, and “phone” that I wish to not show. And also, where in the template should I put the php line of code?

    Thanks

    1. You can do this in the shortcode using the “fields” or “groups” attribute. For example to use the “fields” attribute, you would list all the field you want shown (sorry, you can’t just exclude some fields) for example:

      [pdb_single fields="first_name,last_name,city,state"]

      The “groups” attribute works similarly, only with a list of field groups. This is much more convenient if you have a lot of fields to manage.

      1. That is awesome, I’ll give it a try!
        But, if you have two different forms then that solution is not gonna work. I had in mind to modify the template were if someone filled out a specific form just to show that group of fields instead of everything. What do you think?
        BTW, thanks a lot!

        1. One way to do this is to use a custom template that determines which shortcode to use based on a value in the record. Take a look at this gist which shows how to set up a custom template for the single record to do that:

          pdb-single-dual.php

        2. that looks super easy!
          but I tried but is not doing it.
          What should I replace in these variables?

          participant_values
          type
          player
          parent

        3. Bruce, it’s up to you to figure out the exact code you need to use in your case, I can only give you the general plan.

  2. Hi Roland,
    I followed everything in detail, the only issue is that the form is not saving in the database the hidden field: post->post_name

    My list was not showing me any result and when I went to Edit Existing Participant Record I saw the field empty.

    What am I doing wrong?

    Thanks a lot!

    1. Check to see that your hidden field has the post->post_name setting in the “Default” parameter of the field.

  3. Hi Roland. Hope you’re well.

    After some to-ing and fro-ing and a great deal of help from you a little while ago, which led to a fix for a new update, I have the searchable list on our site working perfectly.

    However, I have read through this thread and others too but none really seem to answer my question, so here goes…

    I have a database full of KIA soldiers from WW1 from the Greater London region for our site users to search, in order to find where there loved ones/relatives may have a memorial/grave site and where it is. This is working perfectly.

    How would I be able to ‘split’ the information for the front end user to search (i.e. a WW1 search page and a separate WW2 search page) when I upload the WW2 details to the single database?

    I’m thinking 2 groups and a shortcode to search that specific group only??

    I think adding a WW1 or WW2 field into the original database would result in a bit of a clumsy search interface – I’d like to keep them both completely separate rather than as a drop down option. Keep it simple as possible for the users.

    Essentially, all front end addition of any user info is done by me (as a csv import), no new site user info is added as the site is for displaying ONLY the results of the search of that imported user info, which it does brilliantly – but I’m worried about uploading the second csv of the WW2 names to the database until I know what to do with them!

    Look forward to your reply.

    Cheers

    Mark

    1. Hi Mark,

      How I suggest you do this is to have a field in your records that identifies which war the record is from. Once you have that you can set up two search pages, one for each war. In the shortcode for those pages, you add a filter so that only records from one war will show. The search results will be confined to record that match the filter. For example: [pdb_list filter="war=WWI"] You will need to modify that to whatever names and values you end up using for that.

      1. Brilliant.

        So that’s ok for the new WW2 list upload, but if I leave the current list as it is (which has no WW1 field), is there a short code to show all EXCEPT WW2 results, or would it only work by reuploading the original csv file with extra field?

        1. Good question, I should have provided a link to the docs so you can see what’s possible. Yes, you can filter for a value not being there, that will work. In the long run it’s better to filter for the presence of a specific value because that will give you more flexibility. This page provides all the details:

          List Shortcode Filters

  4. Hello Roland,
    Is it possible to have two “single record page” ?
    I have two types of data in a database. 1. participant database 2. Facilities database
    I can call each database separately in different pdb list pages using filters.
    The issue is: layout for 1. participant database is totally different for 2. facilities database. How do I get the single record link field to open different single record page?

    kind regards.

    1. Hi, so i figured i can get this to work with single_record_link in the list page. Problem is, the short code is returned in text without processing.
      this is the code on the list page : [pdb_list single_record_link=”document-details” search=true sort=true display_count=true list_limit=20 filter=”library=yes” fields=”event, category, presenter, presentation, file” ]

      code works fine if i remove ” single_record_link=”document-details” ”
      document-details is the slug for a page with [pdb_single] shortcode

      1. so i got this working by making the slug one word without hyphens.

        1. Hi, I’m confused with your answer. I have 2 forms and 2 lists like you, the problem is the details page. It takes me to a page with all the fields (of the 2 forms) displayed. I would like to have the “details” page to show a different page depending on which list you are. Were you able to accomplish this?
          Thanks!

        2. Luis,

          Scratch that last answer…if I understand you correctly, you have two different shortcodes showing two different lists, right? In that case, you can use the “single_record_link” attribute to set the target page for the single record link… for example:

          [pdb_list single_record_link="detail-1"]
          
          [pdb_list single_record_link="detail-2"]
        3. Hi Roland,
          It is awesome that you take the time to answer these questions, and I wanted to let you know that I really appreciate it :)

          Regarding your answer, I think that i understand your solution, but where I get confused in your sample, is the part that says: “detail-1” and “detail-2”, what information should I put in there? is it a page I create with [pdb_single]?

          Sorry I’m a little lost there.

        4. “detail-1″ and ‘detail-2” are supposed to be the page names of your two different single record pages. The can be named anything you want, those are just examples. Each of those pages should have a [pdb_single] shortcode on them. You can then customize the display for each page by adding attributes to the shortcodes.

  5. Aloha Roland!
    I’m hoping to use your great plug in for a client’s database. She has a bridal consignment store and needs to keep records of clients and dresses (since she doesn’t own the dresses). She needs two databases that speak to eachother – connecting 2 different ID’s. One ID is for the customer profile, the other for the dress profile. The customer profile ID references back to the dress ID. Two spreadsheets. Is this possible to do with Participants?

    1. Hi Christine,

      Participants Database in it’s current form is not well suited to this kind of application because there is no simple way to associate one database with another. I do have this on the list of expansions, but it’s not available at this time.

  6. Hi, thanks for this tutorial.
    I’ve set two groups of fields (pilots and tracks) correctly but I have a problem for editing fields.
    I can not set a page for editing pilots informations, and a page for tracks.
    Eather I show all fields in edit records page, eather I need to chose groups.

    How can I achieve this please ?

    1. You can use the “fields” or “groups” attribute in the pdb_record shortcode:

      The Fields atrribute

  7. Hi Roland, I’ve use the [pdb_signup groups="contact,delivery_status"] shortcode at the sku page. I cant show the filter on my page. Is my shortcode correct? [pdb_list filter='type=sku=active'] thanks more power :)

    1. No, the filter is not correct, but I’m not sure what you’re looking for. Take a look at the docs, it explains how the filters work:

      List Shortcode Filters

      1. sorry for such a noob question, for example i have a sign-up form which i used [pdb_signup groups="contact,delivery_status"]. What I want is to show the pdb_list looks like the form fields in the sign up form, the other columns are hidden. I am not sure if it is also like the showing the roster article at the top :)

    2. sorry for such a noob question, for example i have a sign-up form which i used [pdb_signup groups="contact,delivery_status"]. What I want is to show the pdb_list looks like the form fields in the sign up form, the other columns are hidden. I am not sure if it is also like the showing the roster article at the top :)

  8. This sounds about the right place;

    My client’s looking for a situation where certain fields would outline a list of things with multiple values A Date, Details, Passmark, etc is it possible to have linked fields like this in PDB?

    1. Participants Database doesn’t have the ability to include a list of things in a field. I’m planning to add this functionality, but it’s not currently available.

  9. Hi Roland, I have a question with regards to your post above. Say I am looking to have a participant sign up, and then a new record every time they attend a meet. Say in addition to this, we want to record a goal total for that day. So over a season we can list then they attended meets, and how many scores in each meet. It may be more than one record in one day. For example one record would be for the first half, and another in the second half. Each record would need to be unique, but tied to that participant.

    Is this possible in PD ?

    1. Perhaps the simplest approach to something like this would be to register your members as WordPress users, then use Participants Database to keep track of the goal totals. In this article, I explain how to have Participants Database records tied to a particular user:

      Using Participants Database with WordPress Users

  10. Don’t think this quite resolved a problem I’m having. I’m trying to merge new data into an existing PD database. For instance, I need to add recent game statistics into an existing player’s profile. Can I merge a CSV file with an existing PD DB using the email (unique identifier) to determine which profile record the data goes into? I only want to update the profile fields specified in the new CSV.

    1. Yes, you can do this. As long as you have your unique identifier in the CSV, you can use the CSV to update records in the database. On the CSV import page, you can determine what field is used to find a matching record, and set it up to update data in that record.

      1. Thank you, Roland! I will give it a try!

Leave a Reply

Your email address will not be published. Required fields are marked *

Would you like to be notified of followup comments via e-mail? You can also subscribe without commenting.

61 thoughts on ““Multiple Databases” with Participants Database

  1. How to exclude some fields from the Single Record Page [pdb_single]?

    In my form I have the fields “name”, “address”, and “phone” that I wish to not show. And also, where in the template should I put the php line of code?

    Thanks

    1. You can do this in the shortcode using the “fields” or “groups” attribute. For example to use the “fields” attribute, you would list all the field you want shown (sorry, you can’t just exclude some fields) for example:

      [pdb_single fields="first_name,last_name,city,state"]

      The “groups” attribute works similarly, only with a list of field groups. This is much more convenient if you have a lot of fields to manage.

      1. That is awesome, I’ll give it a try!
        But, if you have two different forms then that solution is not gonna work. I had in mind to modify the template were if someone filled out a specific form just to show that group of fields instead of everything. What do you think?
        BTW, thanks a lot!

        1. One way to do this is to use a custom template that determines which shortcode to use based on a value in the record. Take a look at this gist which shows how to set up a custom template for the single record to do that:

          pdb-single-dual.php

        2. that looks super easy!
          but I tried but is not doing it.
          What should I replace in these variables?

          participant_values
          type
          player
          parent

        3. Bruce, it’s up to you to figure out the exact code you need to use in your case, I can only give you the general plan.

  2. Hi Roland,
    I followed everything in detail, the only issue is that the form is not saving in the database the hidden field: post->post_name

    My list was not showing me any result and when I went to Edit Existing Participant Record I saw the field empty.

    What am I doing wrong?

    Thanks a lot!

    1. Check to see that your hidden field has the post->post_name setting in the “Default” parameter of the field.

  3. Hi Roland. Hope you’re well.

    After some to-ing and fro-ing and a great deal of help from you a little while ago, which led to a fix for a new update, I have the searchable list on our site working perfectly.

    However, I have read through this thread and others too but none really seem to answer my question, so here goes…

    I have a database full of KIA soldiers from WW1 from the Greater London region for our site users to search, in order to find where there loved ones/relatives may have a memorial/grave site and where it is. This is working perfectly.

    How would I be able to ‘split’ the information for the front end user to search (i.e. a WW1 search page and a separate WW2 search page) when I upload the WW2 details to the single database?

    I’m thinking 2 groups and a shortcode to search that specific group only??

    I think adding a WW1 or WW2 field into the original database would result in a bit of a clumsy search interface – I’d like to keep them both completely separate rather than as a drop down option. Keep it simple as possible for the users.

    Essentially, all front end addition of any user info is done by me (as a csv import), no new site user info is added as the site is for displaying ONLY the results of the search of that imported user info, which it does brilliantly – but I’m worried about uploading the second csv of the WW2 names to the database until I know what to do with them!

    Look forward to your reply.

    Cheers

    Mark

    1. Hi Mark,

      How I suggest you do this is to have a field in your records that identifies which war the record is from. Once you have that you can set up two search pages, one for each war. In the shortcode for those pages, you add a filter so that only records from one war will show. The search results will be confined to record that match the filter. For example: [pdb_list filter="war=WWI"] You will need to modify that to whatever names and values you end up using for that.

      1. Brilliant.

        So that’s ok for the new WW2 list upload, but if I leave the current list as it is (which has no WW1 field), is there a short code to show all EXCEPT WW2 results, or would it only work by reuploading the original csv file with extra field?

        1. Good question, I should have provided a link to the docs so you can see what’s possible. Yes, you can filter for a value not being there, that will work. In the long run it’s better to filter for the presence of a specific value because that will give you more flexibility. This page provides all the details:

          List Shortcode Filters

  4. Hello Roland,
    Is it possible to have two “single record page” ?
    I have two types of data in a database. 1. participant database 2. Facilities database
    I can call each database separately in different pdb list pages using filters.
    The issue is: layout for 1. participant database is totally different for 2. facilities database. How do I get the single record link field to open different single record page?

    kind regards.

    1. Hi, so i figured i can get this to work with single_record_link in the list page. Problem is, the short code is returned in text without processing.
      this is the code on the list page : [pdb_list single_record_link=”document-details” search=true sort=true display_count=true list_limit=20 filter=”library=yes” fields=”event, category, presenter, presentation, file” ]

      code works fine if i remove ” single_record_link=”document-details” ”
      document-details is the slug for a page with [pdb_single] shortcode

      1. so i got this working by making the slug one word without hyphens.

        1. Hi, I’m confused with your answer. I have 2 forms and 2 lists like you, the problem is the details page. It takes me to a page with all the fields (of the 2 forms) displayed. I would like to have the “details” page to show a different page depending on which list you are. Were you able to accomplish this?
          Thanks!

        2. Luis,

          Scratch that last answer…if I understand you correctly, you have two different shortcodes showing two different lists, right? In that case, you can use the “single_record_link” attribute to set the target page for the single record link… for example:

          [pdb_list single_record_link="detail-1"]
          
          [pdb_list single_record_link="detail-2"]
        3. Hi Roland,
          It is awesome that you take the time to answer these questions, and I wanted to let you know that I really appreciate it :)

          Regarding your answer, I think that i understand your solution, but where I get confused in your sample, is the part that says: “detail-1” and “detail-2”, what information should I put in there? is it a page I create with [pdb_single]?

          Sorry I’m a little lost there.

        4. “detail-1″ and ‘detail-2” are supposed to be the page names of your two different single record pages. The can be named anything you want, those are just examples. Each of those pages should have a [pdb_single] shortcode on them. You can then customize the display for each page by adding attributes to the shortcodes.

  5. Aloha Roland!
    I’m hoping to use your great plug in for a client’s database. She has a bridal consignment store and needs to keep records of clients and dresses (since she doesn’t own the dresses). She needs two databases that speak to eachother – connecting 2 different ID’s. One ID is for the customer profile, the other for the dress profile. The customer profile ID references back to the dress ID. Two spreadsheets. Is this possible to do with Participants?

    1. Hi Christine,

      Participants Database in it’s current form is not well suited to this kind of application because there is no simple way to associate one database with another. I do have this on the list of expansions, but it’s not available at this time.

  6. Hi, thanks for this tutorial.
    I’ve set two groups of fields (pilots and tracks) correctly but I have a problem for editing fields.
    I can not set a page for editing pilots informations, and a page for tracks.
    Eather I show all fields in edit records page, eather I need to chose groups.

    How can I achieve this please ?

    1. You can use the “fields” or “groups” attribute in the pdb_record shortcode:

      The Fields atrribute

  7. Hi Roland, I’ve use the [pdb_signup groups="contact,delivery_status"] shortcode at the sku page. I cant show the filter on my page. Is my shortcode correct? [pdb_list filter='type=sku=active'] thanks more power :)

    1. No, the filter is not correct, but I’m not sure what you’re looking for. Take a look at the docs, it explains how the filters work:

      List Shortcode Filters

      1. sorry for such a noob question, for example i have a sign-up form which i used [pdb_signup groups="contact,delivery_status"]. What I want is to show the pdb_list looks like the form fields in the sign up form, the other columns are hidden. I am not sure if it is also like the showing the roster article at the top :)

    2. sorry for such a noob question, for example i have a sign-up form which i used [pdb_signup groups="contact,delivery_status"]. What I want is to show the pdb_list looks like the form fields in the sign up form, the other columns are hidden. I am not sure if it is also like the showing the roster article at the top :)

  8. This sounds about the right place;

    My client’s looking for a situation where certain fields would outline a list of things with multiple values A Date, Details, Passmark, etc is it possible to have linked fields like this in PDB?

    1. Participants Database doesn’t have the ability to include a list of things in a field. I’m planning to add this functionality, but it’s not currently available.

  9. Hi Roland, I have a question with regards to your post above. Say I am looking to have a participant sign up, and then a new record every time they attend a meet. Say in addition to this, we want to record a goal total for that day. So over a season we can list then they attended meets, and how many scores in each meet. It may be more than one record in one day. For example one record would be for the first half, and another in the second half. Each record would need to be unique, but tied to that participant.

    Is this possible in PD ?

    1. Perhaps the simplest approach to something like this would be to register your members as WordPress users, then use Participants Database to keep track of the goal totals. In this article, I explain how to have Participants Database records tied to a particular user:

      Using Participants Database with WordPress Users

  10. Don’t think this quite resolved a problem I’m having. I’m trying to merge new data into an existing PD database. For instance, I need to add recent game statistics into an existing player’s profile. Can I merge a CSV file with an existing PD DB using the email (unique identifier) to determine which profile record the data goes into? I only want to update the profile fields specified in the new CSV.

    1. Yes, you can do this. As long as you have your unique identifier in the CSV, you can use the CSV to update records in the database. On the CSV import page, you can determine what field is used to find a matching record, and set it up to update data in that record.

      1. Thank you, Roland! I will give it a try!

Leave a Reply

Your email address will not be published. Required fields are marked *

Would you like to be notified of followup comments via e-mail? You can also subscribe without commenting.