Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-19195

Duplicate entry in civicrm_uf_match when forcing account creation

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 4.7.10
    • Fix Version/s: None
    • Component/s: WordPress Integration
    • Labels:
      None
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      Steps to Reproduce

      I'm not sure all of the following are necessary, but these are the step I took to trigger this reliably repeatable error:

      1. Configure WP to allow anyone to register (Settings > General).
      2. Ensure that the Supporter Profile is set to require account creation and update matching contacts.
      3. Create a contribution page.
      4. On the Title tab, check "Allow individuals to contribute and/or signup for membership on behalf of an organization?" Select "On Behalf of Organization." Select the "Required" radio button.
      5. On the Membership tab, check "Membership Section Enabled?" Check the General and Student membership types. Check "Require Membership Signup."
      6. On the Profiles tab, select Supporter Profile for the bottom of the page.

      As an anonymous user, fill out the form, and you will get a fatal error.

      Technical

      The database error code is:

      Duplicate entry 'frank@example.org-1' for key 'UI_uf_name_domain_id', 1062

      The failing query is:

      INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES ( 1 , 3 , 'frank@example.org' , 205 )

      In CiviCRM, you will find:

      • Contact ID x: The individual who filled out the form, with a relationship to:
      • Contact ID x + 1: The organization contact record, with a contribution record but no membership record.
      • Contact ID x + 2: An individual contact record with an associated WP account. The contact record consists of only the email address for Contact ID x.

      The backtrace is:

      Aug 08 08:24:31  [info] $backTrace = #0 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(227): CRM_Core_Error::backtrace("backTrace", TRUE)
      #1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
      #2 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
      #3 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: already exists", -5, 16, (Array:2), "INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALU...")
      #4 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-5, 16, (Array:2), "INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALU...")
      #5 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -5, NULL, NULL, "INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALU...", "DB_Error", TRUE)
      #6 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/mysql.php(895): DB_common->raiseError(-5, NULL, NULL, NULL, "1062 ** Duplicate entry 'frank@example.org-1' for key 'UI_uf_name_...")
      #7 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
      #8 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALU...")
      #9 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2438): DB_common->query("INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALU...")
      #10 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(1060): DB_DataObject->_query("INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALU...")
      #11 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(477): DB_DataObject->insert()
      #12 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/UFMatch.php(55): CRM_Core_DAO->save()
      #13 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CMSUser.php(66): CRM_Core_BAO_UFMatch::create((Array:3))
      #14 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Contribute/BAO/Contribution/Utils.php(336): CRM_Core_BAO_CMSUser::create((Array:72), "email-5")
      #15 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1024): CRM_Contribute_BAO_Contribution_Utils::createCMSUser((Array:72), "3353", "email-5")
      #16 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Contribute/BAO/Contribution/Utils.php(118): CRM_Contribute_Form_Contribution_Confirm::processFormContribution(Object(CRM_Contribute_Form_Contribution_Confirm), (Array:67), NULL, (Array:7), Object(CRM_Financial_DAO_FinancialType), TRUE, 5, "0")
      #17 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1427): CRM_Contribute_BAO_Contribution_Utils::processConfirm(Object(CRM_Contribute_Form_Contribution_Confirm), (Array:67), "3353", "2", "membership", FALSE, "0")
      #18 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1364): CRM_Contribute_Form_Contribution_Confirm->postProcessMembership((Array:61), "3353", Object(CRM_Contribute_Form_Contribution_Confirm), (Array:50), (Array:0), (Array:3), (Array:13), (Array:1), TRUE, NULL, FALSE, "2", (Array:0), 0, TRUE)
      #19 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(2279): CRM_Contribute_Form_Contribution_Confirm->processMembership((Array:61), "3353", (Array:0), (Array:3), (Array:50), (Array:0), 0)
      #20 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(2153): CRM_Contribute_Form_Contribution_Confirm->doMembershipProcessing("3353", (Array:58), (Array:50), 0)
      #21 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(597): CRM_Contribute_Form_Contribution_Confirm->processFormSubmission(NULL)
      #22 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(423): CRM_Contribute_Form_Contribution_Confirm->postProcess()
      #23 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/StateMachine.php(160): CRM_Core_Form->mainProcess()
      #24 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine->perform(Object(CRM_Contribute_Form_Contribution_Confirm), "next", "Next")
      #25 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Contribute_Form_Contribution_Confirm), "next")
      #26 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contribute_Form_Contribution_Confirm), "next")
      #27 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("next")
      #28 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(312): CRM_Core_Controller->run((Array:3), NULL)
      #29 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:15))
      #30 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
      #31 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/civicrm.php(1227): CRM_Core_Invoke::invoke((Array:3))
      #32 /home/example/websites/example.org/htdocs/wp-content/plugins/civicrm/includes/civicrm.basepage.php(132): CiviCRM_For_WordPress->invoke()
      #33 [internal function](): CiviCRM_For_WordPress_Basepage->basepage_handler(Object(WP))
      #34 /home/example/websites/example.org/htdocs/wp-includes/plugin.php(601): call_user_func_array((Array:2), (Array:1))
      #35 /home/example/websites/example.org/htdocs/wp-includes/class-wp.php(737): do_action_ref_array("wp", (Array:1))
      #36 /home/example/websites/example.org/htdocs/wp-includes/functions.php(952): WP->main("")
      #37 /home/example/websites/example.org/htdocs/wp-blog-header.php(16): wp()
      #38 /home/example/websites/example.org/htdocs/index.php(17): require("/home/example/websites/example.org/htdocs/wp-blog-header.php")
      #39 {main}
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              pittstains Frank J. Gómez
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: