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.

shows the field setup array

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.

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

  1. Dear Roland:
    How to use this plugin with signup form?
    1. Install the plugin
    2. Once installed, it will automatically check if the first name and last name have an existing record from the database once the signup form have been submitted OR right after encoding the first name and last name?
    3. Is there something to add with the [pdb_signup] shortcode? for this plugin to work?

    Thanks and need advice.
    Rdgs;
    javz

    1. Hi Roland:
      I tried to install this plugin “pdb-multi-field-match-import.php” but it failed,
      therefore, I tried to install the plugin “pdb-check-multiple.php”, it was installed with out errors, but you said that this is outdated and will not work with PDB 1.9.4 and above, I guess your correct since the validation being followed is from the signup duplicate validation setting, Pls. need your help on which plugin works and how to disable the signup validation setting so that the plugin’s validation will be followed..

      Thanks and Regards;
      javz

      1. Hi Roland:
        This is the message:

        Installing plugin from uploaded file: 54c0fb799707ce9b3a56714e9f6ae517-0f00a63389420651d0594d01b709341596ac0cb3.zip
        Unpacking the package…

        Installing the plugin…

        The package could not be installed. No valid plugins were found.

        Plugin installation failed.

        1. I suggest you try again? It’s working for me.

        2. Hi Roland:
          I was able to install the plugin w/o errors, but when i tested the signup form, I got this error: (What does it mean?)Thanks

          Fatal error: Uncaught ArgumentCountError: Too few arguments to function PDb_Multifield_Match_Import::check_for_match(), 3 passed in C:\xampp\htdocs\wpsite\wp-includes\class-wp-hook.php on line 287 and exactly 4 expected in C:\xampp\htdocs\wpsite\wp-content\plugins\pdb-multi-field-match-import\pdb-multi-field-match-import.php:41 Stack trace: #0 C:\xampp\htdocs\wpsite\wp-includes\class-wp-hook.php(287): PDb_Multifield_Match_Import->check_for_match(NULL, Array, ‘2’) #1 C:\xampp\htdocs\wpsite\wp-includes\plugin.php(206): WP_Hook->apply_filters(NULL, Array) #2 C:\xampp\htdocs\wpsite\wp-content\plugins\participants-database\classes\PDb_Base.php(1214): apply_filters(‘pdb-incoming_re…’, NULL, Array, ‘2’) #3
          C:\xampp\htdocs\wpsite\wp-content\plugins\participants-database\classes\PDb_Base.php(1230): PDb_Base::set_filter(‘pdb-incoming_re…’, NULL, Array, ‘2’) #4 C:\xampp\htdocs\wpsite\wp-content\plugins\participants-database\classes\PDb_submission\incoming_record_match.php(131): PDb_Base::apply_filters(‘incoming_record…’, NULL, in C:\xampp\htdocs\wpsite\wp-content\plugins\pdb-multi-field-match-import\pdb-multi-field-match-import.php on line 41
          There has been a critical error on your website.

        3. Hi I’m sorry, there was an error in the code…delete the plugin and then install the latest one:

          https://gist.github.com/xnau/54c0fb799707ce9b3a56714e9f6ae517/archive/b23920fd7e6c748139ec315119ea9a284e7097a4.zip

  2. Hi Roland,
    Thank you for your great work. I want to use de csv-import but also get emty fields. I’ve tried everything possible to import the csv. Also from the blank record-file provided, but everytime i have empty fields.
    The csv’s code is UTF-8 and komma delimited. What can be wrong?

    1. First make sure the field type matches the data, if you’ve got the wrong kind of data for the field you’re trying to import it into, it won’t work as expected. Also, make sure the enclosure and delimiter characters match the ones used in your CSV file.

      Take a look at this article for the details: Migrating an Existing Database into Participants Database

  3. 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

  4. 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.

  5. 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.

  6. 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.

  7. 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?

  8. 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

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.

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

  1. Dear Roland:
    How to use this plugin with signup form?
    1. Install the plugin
    2. Once installed, it will automatically check if the first name and last name have an existing record from the database once the signup form have been submitted OR right after encoding the first name and last name?
    3. Is there something to add with the [pdb_signup] shortcode? for this plugin to work?

    Thanks and need advice.
    Rdgs;
    javz

    1. Hi Roland:
      I tried to install this plugin “pdb-multi-field-match-import.php” but it failed,
      therefore, I tried to install the plugin “pdb-check-multiple.php”, it was installed with out errors, but you said that this is outdated and will not work with PDB 1.9.4 and above, I guess your correct since the validation being followed is from the signup duplicate validation setting, Pls. need your help on which plugin works and how to disable the signup validation setting so that the plugin’s validation will be followed..

      Thanks and Regards;
      javz

      1. Hi Roland:
        This is the message:

        Installing plugin from uploaded file: 54c0fb799707ce9b3a56714e9f6ae517-0f00a63389420651d0594d01b709341596ac0cb3.zip
        Unpacking the package…

        Installing the plugin…

        The package could not be installed. No valid plugins were found.

        Plugin installation failed.

        1. I suggest you try again? It’s working for me.

        2. Hi Roland:
          I was able to install the plugin w/o errors, but when i tested the signup form, I got this error: (What does it mean?)Thanks

          Fatal error: Uncaught ArgumentCountError: Too few arguments to function PDb_Multifield_Match_Import::check_for_match(), 3 passed in C:\xampp\htdocs\wpsite\wp-includes\class-wp-hook.php on line 287 and exactly 4 expected in C:\xampp\htdocs\wpsite\wp-content\plugins\pdb-multi-field-match-import\pdb-multi-field-match-import.php:41 Stack trace: #0 C:\xampp\htdocs\wpsite\wp-includes\class-wp-hook.php(287): PDb_Multifield_Match_Import->check_for_match(NULL, Array, ‘2’) #1 C:\xampp\htdocs\wpsite\wp-includes\plugin.php(206): WP_Hook->apply_filters(NULL, Array) #2 C:\xampp\htdocs\wpsite\wp-content\plugins\participants-database\classes\PDb_Base.php(1214): apply_filters(‘pdb-incoming_re…’, NULL, Array, ‘2’) #3
          C:\xampp\htdocs\wpsite\wp-content\plugins\participants-database\classes\PDb_Base.php(1230): PDb_Base::set_filter(‘pdb-incoming_re…’, NULL, Array, ‘2’) #4 C:\xampp\htdocs\wpsite\wp-content\plugins\participants-database\classes\PDb_submission\incoming_record_match.php(131): PDb_Base::apply_filters(‘incoming_record…’, NULL, in C:\xampp\htdocs\wpsite\wp-content\plugins\pdb-multi-field-match-import\pdb-multi-field-match-import.php on line 41
          There has been a critical error on your website.

        3. Hi I’m sorry, there was an error in the code…delete the plugin and then install the latest one:

          https://gist.github.com/xnau/54c0fb799707ce9b3a56714e9f6ae517/archive/b23920fd7e6c748139ec315119ea9a284e7097a4.zip

  2. Hi Roland,
    Thank you for your great work. I want to use de csv-import but also get emty fields. I’ve tried everything possible to import the csv. Also from the blank record-file provided, but everytime i have empty fields.
    The csv’s code is UTF-8 and komma delimited. What can be wrong?

    1. First make sure the field type matches the data, if you’ve got the wrong kind of data for the field you’re trying to import it into, it won’t work as expected. Also, make sure the enclosure and delimiter characters match the ones used in your CSV file.

      Take a look at this article for the details: Migrating an Existing Database into Participants Database

  3. 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

  4. 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.

  5. 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.

  6. 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.

  7. 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?

  8. 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

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.