From 231bae89004bce61780ebb993e346ee5fedd88a8 Mon Sep 17 00:00:00 2001 From: patrickmj Date: Thu, 30 Oct 2014 17:52:28 -0400 Subject: [PATCH] fix it so when there's a profile, profile elements aren't added to the Item being contributed --- controllers/ContributionController.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/controllers/ContributionController.php b/controllers/ContributionController.php index 9d900372..d494b476 100644 --- a/controllers/ContributionController.php +++ b/controllers/ContributionController.php @@ -346,9 +346,17 @@ protected function _linkItemToContributedItem($item, $contributor, $post) */ protected function _addElementTextsToItem($item, $elements) { - $elementTable = get_db()->getTable('Element'); + $db = get_db(); + $elementTable = $db->getTable('Element'); + $sql = "SELECT DISTINCT `id` from `$db->ElementSet` WHERE `record_type` = 'UserProfilesType' "; + $userProfilesElementSets = $db->fetchCol($sql); foreach($elements as $elementId => $elementTexts) { $element = $elementTable->find($elementId); + $elSet = $element->getElementSet(); + //need to skip over elements that are intended for a User Profile, not the item + if (in_array($elSet->id, $userProfilesElementSets)) { + continue; + } foreach($elementTexts as $elementText) { if (!empty($elementText['text'])) { $item->addTextForElement($element, $elementText['text']);