Details
Description
Second profile on CiviEvent page doesn't show f the first entry in civicrm_ufgroup is set to is_active = 1.
The reason for this is that CRM_Core_BAO_UFGroup::filterUFGroups expects ID as an integer but in CRM_Event_Form_Registration::buildCustom is passed it as an array. The array is cast to the integer '1' when assigned to a DAO & DAO->find then finds the first profile (& if profile #1 is disabled the profile isn't rendered).
Patch below fixes the problem but per inline comments it might be better to convert the array to an integer earlier. I think perhaps there was an MIH to allow multiple profiles on contribution pages that caused this? The business of CRM_Core_BAO_UFJoin::getUFGroupIds returning the first profile as an integer & the second as an array seems pretty convoluted & an ideal fix would probaby change that.
— a/sites/all/modules/civicrm/CRM/Event/Form/Registration.php
+++ b/sites/all/modules/civicrm/CRM/Event/Form/Registration.php
@@ -399,6 +399,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form
$ufJoinParams = array( 'entity_table' => 'civicrm_event',
'module' => 'CiviEvent', // CRM-4377:<C2><A0>CiviEvent for the main pa
'entity_id' => $this->_eventId );
+ //custom_post_id is returned as an array here - it may make more sense to convert it to an integer here?
list( $this->_values['custom_pre_id'],
$this->_values['custom_post_id'] ) =
CRM_Core_BAO_UFJoin::getUFGroupIds( $ufJoinParams );
@@ -616,7 +617,9 @@ class CRM_Event_Form_Registration extends CRM_Core_Form
'participant_fee_level' => 1
);
if ( $contactID ) {
- if ( CRM_Core_BAO_UFGroup::filterUFGroups($id, $contactID) ) {
+ //custom_post_id is an array rather than an integer & needs to be passed into filterUFGroups
+ // as an integer - it might make more sense to fix this in pre-Process than here?
+ if ( CRM_Core_BAO_UFGroup::filterUFGroups(is_array($id)?$id[0]: $id, $contactID) ) {
$fields = CRM_Core_BAO_UFGroup::getFields( $id, false, CRM_Core_Action::ADD,
null , null, false, null,
false, null, CRM_Core_Permission::CREATE,