CRM-17029 - Add to Group profile setting doesn't work on petitions
authorJon goldberg <jon@palantetech.coop>
Thu, 11 Feb 2016 23:06:38 +0000 (18:06 -0500)
committerJon goldberg <jon@palantetech.coop>
Thu, 11 Feb 2016 23:06:38 +0000 (18:06 -0500)
CRM/Campaign/Form/Petition/Signature.php

index 0693788fe0ee93d2d0df1d3fb564e6f0f102e948..a8a477622ff31405354b9932162416589d367afe 100644 (file)
@@ -482,7 +482,9 @@ class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form {
 
     $transaction = new CRM_Core_Transaction();
 
-    $addToGroupID = isset($this->_addToGroupID) ? $this->_addToGroupID : NULL;
+    // CRM-17029 - get the add_to_group_id from the _contactProfileFields array.
+    $firstField = array_shift(array_slice($this->_contactProfileFields, 0, 1));
+    $addToGroupID = isset($firstField['add_to_group_id']) ? $firstField['add_to_group_id'] : NULL;
     $this->_contactId = CRM_Contact_BAO_Contact::createProfileContact($params, $this->_contactProfileFields,
       $this->_contactId, $addToGroupID,
       $this->_contactProfileId, $this->_ctype,