Skip to content

Commit

Permalink
fix it so when there's a profile, profile elements aren't added to th…
Browse files Browse the repository at this point in the history
…e Item being contributed
  • Loading branch information
patrickmj committed Oct 30, 2014
1 parent 1ef2b17 commit 231bae8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion controllers/ContributionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down

0 comments on commit 231bae8

Please sign in to comment.