diff --git a/administrator/language/en-GB/plg_content_joomla.ini b/administrator/language/en-GB/plg_content_joomla.ini
index 0cf5749dddb3f..c7f64edcf915a 100644
--- a/administrator/language/en-GB/plg_content_joomla.ini
+++ b/administrator/language/en-GB/plg_content_joomla.ini
@@ -8,8 +8,4 @@ PLG_CONTENT_JOOMLA_FIELD_CHECK_CATEGORIES_DESC="Check that categories are fully
PLG_CONTENT_JOOMLA_FIELD_CHECK_CATEGORIES_LABEL="Check Category Deletion"
PLG_CONTENT_JOOMLA_FIELD_EMAIL_NEW_FE_DESC="Email users if 'Send email' is on when there is a new article submitted via the Frontend."
PLG_CONTENT_JOOMLA_FIELD_EMAIL_NEW_FE_LABEL="Email on New Site Article"
-PLG_CONTENT_JOOMLA_FIELD_EMAIL_NEW_STAGE_DESC="Email users if 'Send email' is on when there is a status change of an article."
-PLG_CONTENT_JOOMLA_FIELD_EMAIL_NEW_STAGE_LABEL="Email on transition execution"
-PLG_CONTENT_JOOMLA_ON_STAGE_CHANGE_MSG="The status of an article has been changed by '%1$s' entitled '%2$s'."
-PLG_CONTENT_JOOMLA_ON_STAGE_CHANGE_SUBJECT="Status of article has changed"
PLG_CONTENT_JOOMLA_XML_DESCRIPTION="This plugin does category processing for core extensions; sends an email when new article is submitted in the Frontend or a transition is executed."
diff --git a/administrator/language/en-GB/plg_workflow_notification.ini b/administrator/language/en-GB/plg_workflow_notification.ini
new file mode 100644
index 0000000000000..162306c97b3a5
--- /dev/null
+++ b/administrator/language/en-GB/plg_workflow_notification.ini
@@ -0,0 +1,23 @@
+; Joomla! Project
+; Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved.
+; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
+; Note : All ini files need to be saved as UTF-8
+
+COM_WORKFLOW_NOTIFICATION_FIELDSET_LABEL="Notification"
+PLG_WORKFLOW_NOTIFICATION="Workflow - Notification"
+PLG_WORKFLOW_NOTIFICATION_ADDTEXT="The state has changed"
+PLG_WORKFLOW_NOTIFICATION_ADDTEXT_AUTHOR_DESC="You can localise the text by using a Language key and make language overrides."
+PLG_WORKFLOW_NOTIFICATION_ADDTEXT_AUTHOR_LABEL="Additional Message to Author"
+PLG_WORKFLOW_NOTIFICATION_ADDTEXT_DESC="You can localise the text by using a Language key and make language overrides."
+PLG_WORKFLOW_NOTIFICATION_ADDTEXT_LABEL="Additional Message Text"
+PLG_WORKFLOW_NOTIFICATION_EMAIL_AUTHOR_LABEL="Email the Author"
+PLG_WORKFLOW_NOTIFICATION_ON_TRANSITION_SUBJECT="The status of an '%1$s' has been changed";
+PLG_WORKFLOW_NOTIFICATION_ON_TRANSITION_MSG="Title: '%1$s', Changed by '%2$s', New State: '%3$s'."
+PLG_WORKFLOW_NOTIFICATION_RECEIVERS_LABEL="More Receivers"
+PLG_WORKFLOW_NOTIFICATION_RECEIVERS_SELECT="Select single receivers for the notification"
+PLG_WORKFLOW_NOTIFICATION_SENDMAIL_LABEL="Send Notification"
+PLG_WORKFLOW_NOTIFICATION_SENT="Notifications have been sent"
+PLG_WORKFLOW_NOTIFICATION_USERGROUP_DESC="The users in this usergroup get an E-Mail if this transition has been performed"
+PLG_WORKFLOW_NOTIFICATION_USERGROUP_LABEL="Usergroups"
+PLG_WORKFLOW_NOTIFICATION_USERGROUP_SELECT="Select usergroups"
+PLG_WORKFLOW_NOTIFICATION_XML_DESCRIPTION="Send Notification if a Transition has been performed in a Workflow"
diff --git a/administrator/language/en-GB/plg_workflow_notification.sys.ini b/administrator/language/en-GB/plg_workflow_notification.sys.ini
new file mode 100644
index 0000000000000..c585237338360
--- /dev/null
+++ b/administrator/language/en-GB/plg_workflow_notification.sys.ini
@@ -0,0 +1,7 @@
+; Joomla! Project
+; Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved.
+; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
+; Note : All ini files need to be saved as UTF-8
+
+PLG_WORKFLOW_NOTIFICATION="Workflow - Notification"
+PLG_WORKFLOW_NOTIFICATION_XML_DESCRIPTION="Send Notification for Transitions in Publishing Workflow"
\ No newline at end of file
diff --git a/installation/sql/mysql/base.sql b/installation/sql/mysql/base.sql
index 989334a8c214e..3a9743f5ba51e 100644
--- a/installation/sql/mysql/base.sql
+++ b/installation/sql/mysql/base.sql
@@ -359,7 +359,8 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`,
(0, 'plg_system_accessibility', 'plugin', 'accessibility', 'system', 0, 0, 1, 0, 1, '', '{}', 0, NULL, 0, 0),
(0, 'plg_system_webauthn', 'plugin', 'webauthn', 'system', 0, 1, 1, 0, 1, '', '{}', 0, NULL, 0, 0),
(0, 'plg_workflow_publishing', 'plugin', 'publishing', 'workflow', 0, 1, 1, 0, 1, '', '{}', 0, NULL, 0, 0),
-(0, 'plg_workflow_featuring', 'plugin', 'featuring', 'workflow', 0, 1, 1, 0, 1, '', '{}', 0, NULL, 0, 0);
+(0, 'plg_workflow_featuring', 'plugin', 'featuring', 'workflow', 0, 1, 1, 0, 1, '', '{}', 0, NULL, 0, 0),
+(0, 'plg_workflow_notification', 'plugin', 'notification', 'workflow', 0, 1, 1, 0, 1, '', '{}', 0, NULL, 0, 0);
-- Templates
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES
diff --git a/installation/sql/postgresql/base.sql b/installation/sql/postgresql/base.sql
index 0788051ee42a2..205030176d08b 100644
--- a/installation/sql/postgresql/base.sql
+++ b/installation/sql/postgresql/base.sql
@@ -365,7 +365,8 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder",
(0, 'plg_system_accessibility', 'plugin', 'accessibility', 'system', 0, 0, 1, 0, 1, '', '{}', 0, NULL, 0, 0),
(0, 'plg_system_webauthn', 'plugin', 'webauthn', 'system', 0, 1, 1, 0, 1, '', '{}', 0, NULL, 0, 0),
(0, 'plg_workflow_publishing', 'plugin', 'publishing', 'workflow', 0, 1, 1, 0, 1, '', '{}', 0, NULL, 0, 0),
-(0, 'plg_workflow_featuring', 'plugin', 'featuring', 'workflow', 0, 1, 1, 0, 1, '', '{}', 0, NULL, 0, 0);
+(0, 'plg_workflow_featuring', 'plugin', 'featuring', 'workflow', 0, 1, 1, 0, 1, '', '{}', 0, NULL, 0, 0),
+(0, 'plg_workflow_notification', 'plugin', 'notification', 'workflow', 0, 1, 1, 0, 1, '', '{}', 0, NULL, 0, 0);
-- Templates
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "checked_out", "checked_out_time", "ordering", "state") VALUES
diff --git a/plugins/content/joomla/joomla.php b/plugins/content/joomla/joomla.php
index 1c2ed441993b1..1c9cb000c87cf 100644
--- a/plugins/content/joomla/joomla.php
+++ b/plugins/content/joomla/joomla.php
@@ -616,7 +616,7 @@ public function onContentChangeState($context, $pks, $value)
}
// Check if this function is enabled.
- if (!$this->params->def('email_new_stage', 0) || $context != 'com_content.article')
+ if ($context != 'com_content.article')
{
return true;
}
@@ -634,89 +634,6 @@ public function onContentChangeState($context, $pks, $value)
$cctable = new CoreContent($db);
$cctable->publish($ccIds, $value);
- $query = $db->getQuery(true)
- ->select($db->quoteName('id'))
- ->from($db->quoteName('#__users'))
- ->where($db->quoteName('sendEmail') . ' = 1')
- ->where($db->quoteName('block') . ' = 0');
-
- $users = (array) $db->setQuery($query)->loadColumn();
-
- if (empty($users))
- {
- return true;
- }
-
- $user = $this->app->getIdentity();
-
- // Messaging for changed items
- $default_language = ComponentHelper::getParams('com_languages')->get('administrator');
- $debug = $this->app->get('debug_lang');
-
- $article = new ArticleTable($db);
-
- $workflow = new Workflow(['extension' => 'com_content.article']);
-
- foreach ($pks as $pk)
- {
- if (!$article->load($pk))
- {
- continue;
- }
-
- $assoc = $workflow->getAssociation($pk);
- $stageId = (int) $assoc->stage_id;
-
- // Load new transitions
- $query = $db->getQuery(true)
- ->select($db->quoteName('t.id'))
- ->from($db->quoteName('#__workflow_transitions', 't'))
- ->from($db->quoteName('#__workflow_stages', 's'))
- ->where($db->quoteName('t.from_stage_id') . ' = :stageid')
- ->where($db->quoteName('t.to_stage_id') . ' = ' . $db->quoteName('s.id'))
- ->where($db->quoteName('t.published') . ' = 1')
- ->where($db->quoteName('s.published') . ' = 1')
- ->order($db->quoteName('t.ordering'))
- ->bind(':stageid', $stageId, ParameterType::INTEGER);
-
- $transitions = $db->setQuery($query)->loadObjectList();
-
- foreach ($users as $user_id)
- {
- if ($user_id != $user->id)
- {
- // Check if the user has available transitions
- $items = array_filter(
- $transitions,
- function ($item) use ($user)
- {
- return $user->authorise('core.execute.transition', 'com_content.transition.' . $item->id);
- }
- );
-
- if (!count($items))
- {
- continue;
- }
-
- // Load language for messaging
- $receiver = User::getInstance($user_id);
- $lang = Language::getInstance($receiver->getParam('admin_language', $default_language), $debug);
- $lang->load('plg_content_joomla');
-
- $message = array(
- 'user_id_to' => $user_id,
- 'subject' => $lang->_('PLG_CONTENT_JOOMLA_ON_STAGE_CHANGE_SUBJECT'),
- 'message' => sprintf($lang->_('PLG_CONTENT_JOOMLA_ON_STAGE_CHANGE_MSG'), $user->name, $article->title),
- );
-
- $model_message = $this->app->bootComponent('com_messages')
- ->getMVCFactory()->createModel('Message', 'Administrator');
- $model_message->save($message);
- }
- }
- }
-
return true;
}
diff --git a/plugins/content/joomla/joomla.xml b/plugins/content/joomla/joomla.xml
index 51572e9505904..8fbe01231966b 100644
--- a/plugins/content/joomla/joomla.xml
+++ b/plugins/content/joomla/joomla.xml
@@ -44,18 +44,6 @@
-
-