Posted on by

Matching Multiple Fields with CSV Import or Signup Submission

When importing a CSV, it is possible to configure it to match and update existing records. The same process can also be used when a new record is submitted via the signup form. Normally, this is done by matching a single identifying field such as an ID or email address.

In some cases, it’s desirable to perform the match based on multiple fields, such as the first and last name. In this tutorial, I will show you a plugin that lets you set up such a multiple-field matching check.

Setting Up the Match

This plugin works by checking a list of fields that must match an existing record in order for the incoming data to update the matched record in the database.

At the top of the plugin below, you’ll find an array, $match_field_list, where the list of fields you want to check is placed. When a record comes in, either from a signup form or from a CSV file, the contents of that new data is used to search for a record in the database that has the same values in all the fields in that list. If a match is found, the found record is updated with the values in the incoming data. If no match is found, a new record is created with the incoming data.

The Plugin

To use this plugin, click on the link below the code window, download the .zip file, then upload it using the “Add New” item in the admin Plugins menu. To set up the field you want to use for your application, edit the plugin using the plugin file editor. If the plugin file editor is not available, you’ll need to unzip it, edit it on your local machine, zip it, then upload and install.

25 thoughts on “Matching Multiple Fields with CSV Import or Signup Submission

  1. Hi Roland,
    The zip file for the plugin seems to be missing from this page. Do I just copy and paste that code into a text file, save out as php and import/activate it?.

    1. at the bottom on the code box is a link to the “gist” and on that page, you can download the zip.

      Installing a Plugin From A Gist

  2. Hello Admin, great work, well appreciated. Please the CSV import does not seem to import data into my website. it only imports ID leaving the rest of the field in the CSV file. I created a CSV file using the same headings as indicated from the fields already created in the database but yet anytime i try importing it will leave all the fileds empty and only show the id created by the system. This will also come with a notice that all the data have been successfully imported

    1. There may be some formatting issue with your CSV. Make sure that whatever is producing the CSV is formatting it correctly. This may requre that you change some settings, the defaults may not work well. Have you tried looking at your CSV file in a text editor? You may see the problem there.

  3. Hi. I’ve added this plugin to my WordPress multisite and have run it for a small group of records. The error I receive is “Warning: Missing argument 4 for PDb_Multifield_Match_Import::check_for_match() in /home/blogweb/public_html/wp-content/plugins/pdb-multi-field-match-import/pdb-multi-field-match-import.php on line 41.”

    Please can you advise how to fix it?

    1. You must be using the latest version of Participants Database.

  4. Hi Roland, im trying to import csv files that has less than 100 fields. Its seems working good, it say: 37 imported and 27 skipped but cannot find new records imported. Tried twice with same result. What can i do?
    Thanks a lot

    1. If they are new records, you should see them at the top of the list if you sort it by date recorded.

      Are you using any kind of custom code with this? Matching multiple fields?

      1. In fact i can’t see new records, im using Mailchimp Integration

        1. OK, new records where? At MailChimp?

        2. Roland, all imported contact are in Mailchim as “unsuscribed”

        3. OK, I’m trying to understand the problem here. New imported records are not showing up in the admin list, but they are seen in the MailChimp list?

        4. Yes Roland! imported records are displayed in Mailchimp as unsubscribed but not displayed Admin List

        5. That is very odd…new subscribers in MailChimp will either be “subscribed” or “pending” depending on whether you have double-opt-in enabled or not. I don’t have an explanation why your new records aren’t seen in the admin list. I would suggest you try it again.

  5. Hi Roland,
    As mentioned in this thread here: https://wordpress.org/support/topic/csv-import-report-know-quickly-how-each-line-has-been-treated/

    It would be really helpful when importing a CSV to have more information about which records have been skipped, updated or imported. You mention in the support thread that this functionality has been added to the feature list, do you have any approximate release date for this feature?.

    1. It is slated for release in the next major update, it will probably be in a couple of weeks. Do you have a specific issue with importing CSVs?

      1. That’s great to hear. No specific issue, it’s just my client will want to be able to easily match data from a CSV with their existing database so they will need to know exactly which records have or haven’t imported.

        1. OK. If it helps, each record has a “Date Updated” timestamp that can be used to determine if the record was recently updated. This would include an update from a CSV import.

        2. Any news on a release date for this feature?

  6. Hello,

    I love your plugin by the way but have hit a snag.. I want to upload a CSV file with club member data and wordpress.com will not allow this. How can I accomplish this upload.

    Chris Christian

    1. Hi Chris,

      I don’t know, I haven’t tried it on wordpress.com. Did you submit a support request to wordpress.com? It’s probably their configuration that’s stopping it.

      1. Hi,

        I talked to wp support through chat and they said I couldn’t upload a file into WordPress .com I will follow up again.

        1. Thanks, let me now if you learn anything new on this.

        2. Here is what I got from support… No other way to get support except through this chat.

          I have this plugin working great except for this
          WP.comWed, May 9, 12:38 PM
          yes this might not be possible on WordPress.com
          WP.comWed, May 9, 12:39 PM
          like I said
          WP.comWed, May 9, 12:39 PM
          we cannot give access to file uploading like that
          chrch01Wed, May 9, 12:39 PM
          can you escalate this please
          WP.comWed, May 9, 12:40 PM
          escalate?
          WP.comWed, May 9, 12:40 PM
          If you explain what you’d like to do in more detail, I can see if it’s possible.
          chrch01Wed, May 9, 12:42 PM
          on a page where we register customers using woo commerce and a form from Participants DB, we want to collect profile data on the new member. I have an old DB export in CSV and formatted according to Particpants specs and here we are.
          WP.comWed, May 9, 12:42 PM
          ok and?
          chrch01Wed, May 9, 12:43 PM
          So how do I load a csv file into this db
          WP.comWed, May 9, 12:43 PM
          you cannot as you need to upload a file in wp-content, which is not allowed on WordPress.com
          WP.comWed, May 9, 12:44 PM
          I suggest using mailchimp for email collection
          chrch01Wed, May 9, 12:45 PM
          this is really a membership database not just email.. but thanks and I will contact the applications vendor to see if they can help.
          WP.comWed, May 9, 12:46 PM
          if you want more features like memberships and such modifications are necessary, I suggest using WordPress.org

        3. Yes, well I’m sorry to hear that. WordPress.com is a closed platform with strict controls, so I guess it makes sense they don’t allow the uploads.

Leave a Reply
You have to agree to the comment policy.

25 thoughts on “Matching Multiple Fields with CSV Import or Signup Submission

  1. Hi Roland,
    The zip file for the plugin seems to be missing from this page. Do I just copy and paste that code into a text file, save out as php and import/activate it?.

    1. at the bottom on the code box is a link to the “gist” and on that page, you can download the zip.

      Installing a Plugin From A Gist

  2. Hello Admin, great work, well appreciated. Please the CSV import does not seem to import data into my website. it only imports ID leaving the rest of the field in the CSV file. I created a CSV file using the same headings as indicated from the fields already created in the database but yet anytime i try importing it will leave all the fileds empty and only show the id created by the system. This will also come with a notice that all the data have been successfully imported

    1. There may be some formatting issue with your CSV. Make sure that whatever is producing the CSV is formatting it correctly. This may requre that you change some settings, the defaults may not work well. Have you tried looking at your CSV file in a text editor? You may see the problem there.

  3. Hi. I’ve added this plugin to my WordPress multisite and have run it for a small group of records. The error I receive is “Warning: Missing argument 4 for PDb_Multifield_Match_Import::check_for_match() in /home/blogweb/public_html/wp-content/plugins/pdb-multi-field-match-import/pdb-multi-field-match-import.php on line 41.”

    Please can you advise how to fix it?

    1. You must be using the latest version of Participants Database.

  4. Hi Roland, im trying to import csv files that has less than 100 fields. Its seems working good, it say: 37 imported and 27 skipped but cannot find new records imported. Tried twice with same result. What can i do?
    Thanks a lot

    1. If they are new records, you should see them at the top of the list if you sort it by date recorded.

      Are you using any kind of custom code with this? Matching multiple fields?

      1. In fact i can’t see new records, im using Mailchimp Integration

        1. OK, new records where? At MailChimp?

        2. Roland, all imported contact are in Mailchim as “unsuscribed”

        3. OK, I’m trying to understand the problem here. New imported records are not showing up in the admin list, but they are seen in the MailChimp list?

        4. Yes Roland! imported records are displayed in Mailchimp as unsubscribed but not displayed Admin List

        5. That is very odd…new subscribers in MailChimp will either be “subscribed” or “pending” depending on whether you have double-opt-in enabled or not. I don’t have an explanation why your new records aren’t seen in the admin list. I would suggest you try it again.

  5. Hi Roland,
    As mentioned in this thread here: https://wordpress.org/support/topic/csv-import-report-know-quickly-how-each-line-has-been-treated/

    It would be really helpful when importing a CSV to have more information about which records have been skipped, updated or imported. You mention in the support thread that this functionality has been added to the feature list, do you have any approximate release date for this feature?.

    1. It is slated for release in the next major update, it will probably be in a couple of weeks. Do you have a specific issue with importing CSVs?

      1. That’s great to hear. No specific issue, it’s just my client will want to be able to easily match data from a CSV with their existing database so they will need to know exactly which records have or haven’t imported.

        1. OK. If it helps, each record has a “Date Updated” timestamp that can be used to determine if the record was recently updated. This would include an update from a CSV import.

        2. Any news on a release date for this feature?

  6. Hello,

    I love your plugin by the way but have hit a snag.. I want to upload a CSV file with club member data and wordpress.com will not allow this. How can I accomplish this upload.

    Chris Christian

    1. Hi Chris,

      I don’t know, I haven’t tried it on wordpress.com. Did you submit a support request to wordpress.com? It’s probably their configuration that’s stopping it.

      1. Hi,

        I talked to wp support through chat and they said I couldn’t upload a file into WordPress .com I will follow up again.

        1. Thanks, let me now if you learn anything new on this.

        2. Here is what I got from support… No other way to get support except through this chat.

          I have this plugin working great except for this
          WP.comWed, May 9, 12:38 PM
          yes this might not be possible on WordPress.com
          WP.comWed, May 9, 12:39 PM
          like I said
          WP.comWed, May 9, 12:39 PM
          we cannot give access to file uploading like that
          chrch01Wed, May 9, 12:39 PM
          can you escalate this please
          WP.comWed, May 9, 12:40 PM
          escalate?
          WP.comWed, May 9, 12:40 PM
          If you explain what you’d like to do in more detail, I can see if it’s possible.
          chrch01Wed, May 9, 12:42 PM
          on a page where we register customers using woo commerce and a form from Participants DB, we want to collect profile data on the new member. I have an old DB export in CSV and formatted according to Particpants specs and here we are.
          WP.comWed, May 9, 12:42 PM
          ok and?
          chrch01Wed, May 9, 12:43 PM
          So how do I load a csv file into this db
          WP.comWed, May 9, 12:43 PM
          you cannot as you need to upload a file in wp-content, which is not allowed on WordPress.com
          WP.comWed, May 9, 12:44 PM
          I suggest using mailchimp for email collection
          chrch01Wed, May 9, 12:45 PM
          this is really a membership database not just email.. but thanks and I will contact the applications vendor to see if they can help.
          WP.comWed, May 9, 12:46 PM
          if you want more features like memberships and such modifications are necessary, I suggest using WordPress.org

        3. Yes, well I’m sorry to hear that. WordPress.com is a closed platform with strict controls, so I guess it makes sense they don’t allow the uploads.

Leave a Reply
You have to agree to the comment policy.