diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php index 9416817029119..ec6f0c3330804 100644 --- a/administrator/components/com_fields/helpers/fields.php +++ b/administrator/components/com_fields/helpers/fields.php @@ -56,10 +56,12 @@ public static function extract($contextString, $item = null) { $section = call_user_func_array(array($cName, 'validateSection'), array($parts[1], $item)); - if ($section) + if (!$section) { - $parts[1] = $section; + return null; } + + $parts[1] = $section; } } @@ -279,6 +281,9 @@ public static function prepareForm($context, JForm $form, $data) return true; } + // Mark in the form that it is processed by com_fields + $form->load('
'); + $context = $parts[0] . '.' . $parts[1]; // When no fields available return here diff --git a/plugins/system/fields/fields.php b/plugins/system/fields/fields.php index f94c94b557585..78eda3c4e816d 100644 --- a/plugins/system/fields/fields.php +++ b/plugins/system/fields/fields.php @@ -48,6 +48,14 @@ public function onContentAfterSave($context, $item, $isNew, $data = array()) return true; } + $formInput = JFactory::getApplication()->input->get('jform', array(), 'array'); + + // Check if it is a form we have processed + if (!$formInput || empty($formInput['processed-by-fields'])) + { + return; + } + // Create correct context for category if ($context == 'com_categories.category') { @@ -118,14 +126,6 @@ public function onUserAfterSave($userData, $isNew, $success, $msg) $user = JFactory::getUser($userData['id']); - $task = JFactory::getApplication()->input->getCmd('task'); - - // Skip fields save when we activate a user, because we will lose the saved data - if (in_array($task, array('activate', 'block', 'unblock'))) - { - return true; - } - // Trigger the events with a real user $this->onContentAfterSave('com_users.user', $user, false, $userData);