• To replicate, create a contribution page with a membership and a profile that allows account creation.

    I don’t know when this started – though I tested with this extension at 0.6.0 on 5.63 and 5.62, and 0.5.4 on 5.63 – but it’s certainly a regression (most likely caused by a core update).

    Essentially, this extension creates a user as part of member sync (backtrace 1 below) then the contribution page attempts to create one (backtrace 2 below).

    I’m going to dig into this a bit – it seems the contribution page createCmsUser() relies on a static var to see if the user exists. I’ll see if we can test more thoroughly for whether the user exists.

    Backtrace 1

    CRM_Core_BAO_UFMatch::create (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/UFMatch.php:40)
    _civicrm_api3_basic_create (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/api/v3/utils.php:1294)
    civicrm_api3_uf_match_create (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/api/v3/UFMatch.php:39)
    Civi\API\Provider\MagicFunctionProvider->invoke (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/Civi/API/Provider/MagicFunctionProvider.php:89)
    Civi\API\Kernel->runRequest (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php:158)
    Civi\API\Kernel->runSafe (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php:81)
    civicrm_api (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/api/api.php:22)
    Civi_WP_Member_Sync_Users->ufmatch_create (/home/jon/local/mysite/web/wp-content/plugins/civicrm-wp-member-sync/includes/civi-wp-ms-users.php:903)
    Civi_WP_Member_Sync_Users->wp_create_user (/home/jon/local/mysite/web/wp-content/plugins/civicrm-wp-member-sync/includes/civi-wp-ms-users.php:770)
    Civi_WP_Member_Sync_Users->wp_user_create_from_contact_id (/home/jon/local/mysite/web/wp-content/plugins/civicrm-wp-member-sync/includes/civi-wp-ms-users.php:685)
    Civi_WP_Member_Sync_Members->user_prepare_for_sync (/home/jon/local/mysite/web/wp-content/plugins/civicrm-wp-member-sync/includes/civi-wp-ms-members.php:393)
    Civi_WP_Member_Sync_Members->membership_updated (/home/jon/local/mysite/web/wp-content/plugins/civicrm-wp-member-sync/includes/civi-wp-ms-members.php:720)
    WP_Hook->apply_filters (/home/jon/local/mysite/web/wp-includes/class-wp-hook.php:310)
    WP_Hook->do_action (/home/jon/local/mysite/web/wp-includes/class-wp-hook.php:332)
    do_action_ref_array (/home/jon/local/mysite/web/wp-includes/plugin.php:565)
    CRM_Utils_Hook_WordPress->invokeViaUF (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook/WordPress.php:108)
    Civi\Core\CiviEventDispatcher::delegateToUF (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/Civi/Core/CiviEventDispatcher.php:323)
    Symfony\Component\EventDispatcher\EventDispatcher->callListeners (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php:251)
    Symfony\Component\EventDispatcher\EventDispatcher->dispatch (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php:73)
    Civi\Core\CiviEventDispatcher->dispatch (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/Civi/Core/CiviEventDispatcher.php:260)

    Backtrace 2

    CRM_Core_BAO_UFMatch::create (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/UFMatch.php:40)
    CRM_Core_BAO_CMSUser::create (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CMSUser.php:50)
    CRM_Contribute_BAO_Contribution_Utils::createCMSUser (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Contribute/BAO/Contribution/Utils.php:118)
    CRM_Contribute_Form_Contribution_Confirm->createCMSUser (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php:2830)
    CRM_Contribute_Form_Contribution_Confirm->processFormSubmission (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php:2409)
    CRM_Contribute_Form_Contribution_Confirm->postProcess (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php:845)
    CRM_Core_Form->mainProcess (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php:612)
    CRM_Contribute_Form_Contribution_Main->skipToThankYouPage (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Main.php:1349)
    CRM_Contribute_Form_Contribution_Main->postProcess (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Main.php:1097)
    CRM_Core_Form->mainProcess (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php:612)
    CRM_Core_QuickForm_Action_Upload->realPerform (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php:153)
    CRM_Core_QuickForm_Action_Upload->perform (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php:120)
    HTML_QuickForm_Controller->handle (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php:203)
    HTML_QuickForm_Page->handle (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php:103)
    CRM_Core_Controller->run (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:355)
    CRM_Core_Invoke::runItem (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:319)
    CRM_Core_Invoke::_invoke (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69)
    CRM_Core_Invoke::invoke (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36)
    CiviCRM_For_WordPress->invoke (/home/jon/local/mysite/web/wp-content/plugins/civicrm/civicrm.php:1199)
    CiviCRM_For_WordPress_Basepage->basepage_handler (/home/jon/local/mysite/web/wp-content/plugins/civicrm/includes/civicrm.basepage.php:380)
Viewing 1 replies (of 1 total)
  • Plugin Author Christian Wach

    (@needle)

    Thanks for the report @megaphonejon – it seems to me that there should be proper checks for an existing CMS user in CiviCRM-Core before creating one. It shouldn’t be blindly creating a user.

Viewing 1 replies (of 1 total)
  • The topic ‘DB Error: Already exists when creating membership with account creation’ is closed to new replies.