christianwach/civicrm-wp-member-sync

User can no longer be added to a group

Closed this issue · 2 comments

When this plugin is active, a user can no longer be added to a group within CiviCRM.

The following error is logged

Jan 20 17:10:34 [info] $Fatal Error Details = Array
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => handle
)

[code] => -19 
[message] => DB Error: no such field 
[mode] => 16 
[debug_info] => 

SELECT GROUP_CONCAT(contact_id) as contactStr
FROM civicrm_group_contact
WHERE group_id = 7
AND status = 'Added'
AND contact_id IN ( 10613,foo,bar )
[nativecode=1054 ** Unknown column 'foo' in 'where clause']
[type] => DB_Error
[user_info] =>
SELECT GROUP_CONCAT(contact_id) as contactStr
FROM civicrm_group_contact
WHERE group_id = 7
AND status = 'Added'
AND contact_id IN ( 10613,foo,bar )
[nativecode=1054 ** Unknown column 'foo' in 'where clause']
[to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="
SELECT GROUP_CONCAT(contact_id) as contactStr
FROM civicrm_group_contact
WHERE group_id = 7
AND status = 'Added'
AND contact_id IN ( 10613,foo,bar )
[nativecode=1054 ** Unknown column 'foo' in 'where clause']"]
)

Jan 20 17:10:34 [info] $backTrace = #0 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(239): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 internal function: CRM_Core_Error::handle(Object(DB_Error))
#2 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/packages/DB.php(975): PEAR_Error->PEAR_Error("DB Error: no such field", -19, 16, (Array:2), "\nSELECT GROUP_CONCAT(contact_id) as contactStr\nFROM civicrm_group_contact...")
#4 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-19, 16, (Array:2), "\nSELECT GROUP_CONCAT(contact_id) as contactStr\nFROM civicrm_group_contact...")
#5 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -19, NULL, NULL, "\nSELECT GROUP_CONCAT(contact_id) as contactStr\nFROM civicrm_group_contact...", "DB_Error", TRUE)
#6 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/packages/DB/mysql.php(899): DB_common->raiseError(-19, NULL, NULL, NULL, "1054 ** Unknown column 'foo' in 'where clause'")
#7 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
#8 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("\nSELECT GROUP_CONCAT(contact_id) as contactStr\nFROM civicrm_group_contact...")
#9 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2442): DB_common->query("\nSELECT GROUP_CONCAT(contact_id) as contactStr\nFROM civicrm_group_contact...")
#10 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("\nSELECT GROUP_CONCAT(contact_id) as contactStr\nFROM civicrm_group_contact...")
#11 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(325): DB_DataObject->query("\nSELECT GROUP_CONCAT(contact_id) as contactStr\nFROM civicrm_group_contact...")
#12 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(1116): CRM_Core_DAO->query("\nSELECT GROUP_CONCAT(contact_id) as contactStr\nFROM civicrm_group_contact...", TRUE)
#13 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/GroupContact.php(749): CRM_Core_DAO::executeQuery("\nSELECT GROUP_CONCAT(contact_id) as contactStr\nFROM civicrm_group_contact...", (Array:2))
#14 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/GroupContact.php(152): CRM_Contact_BAO_GroupContact::bulkAddContactsToGroup((Array:3), "7", "Admin", "Added", NULL)
#15 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/CRM/Contact/Form/GroupContact.php(135): CRM_Contact_BAO_GroupContact::addContactsToGroup((Array:1), "7", "Admin")
#16 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(328): CRM_Contact_Form_GroupContact->postProcess()
#17 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/CRM/Core/StateMachine.php(162): CRM_Core_Form->mainProcess()
#18 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Next.php(60): CRM_Core_StateMachine->perform(Object(CRM_Contact_Form_GroupContact), "next", "Next")
#19 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Contact_Form_GroupContact), "next")
#20 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_GroupContact), "next")
#21 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(356): HTML_QuickForm_Page->handle("next")
#22 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/GroupContact.php(107): CRM_Core_Controller->run()
#23 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/GroupContact.php(145): CRM_Contact_Page_View_GroupContact->edit(NULL, 1)
#24 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(331): CRM_Contact_Page_View_GroupContact->run((Array:4), NULL)
#25 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(75): CRM_Core_Invoke::runItem((Array:14))
#26 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
#27 /data/sites/web/toxsocbe/www/wp-content/plugins/civicrm/civicrm.php(506): CRM_Core_Invoke::invoke((Array:4))
#28 internal function: CiviCRM_For_WordPress->invoke("")
#29 /data/sites/web/toxsocbe/www/wp-includes/plugin.php(496): call_user_func_array((Array:2), (Array:1))
#30 /data/sites/web/toxsocbe/www/wp-admin/admin.php(212): do_action("toplevel_page_CiviCRM")
#31 {main}

@EventConsulting Hmm are you sure it's to do with this plugin?

SELECT GROUP_CONCAT(contact_id) as contactStr
FROM civicrm_group_contact
WHERE group_id = 7
AND status = 'Added'
AND contact_id IN ( 10613,foo,bar )

I promise you there's nowhere I'm searching for contact_ids called 'foo' and 'bar'!

Ooooh, hang on, I know what's going on... You've got my CiviCRM WordPress Hook Tests plugin active, haven't you?! Disable that. You only need the hooks file from that plugin in your Civi custom php path so it overrides the built in one.

Indeed I had. Confirmed that this was the problem. Sorry for that.