//set custom field defaults
foreach ($this->_fields as $name => $field) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
- if (!isset($this->_defaults[$name])) {
+ // check if the custom field is on a membership, we only want to load
+ // defaults for membership custom fields here, not contact fields
+ if (!isset($this->_defaults[$name])
+ && !CRM_Core_BAO_CustomGroup::checkCustomField($customFieldID, ['Membership'])
+ ) {
CRM_Core_BAO_CustomField::setProfileDefaults($customFieldID, $name, $this->_defaults,
$entityId, CRM_Profile_Form::MODE_REGISTER
);