diff --git a/public_html/lists/admin/actions/processqueue.php b/public_html/lists/admin/actions/processqueue.php
index 9c7ada027..5f1b318ec 100644
--- a/public_html/lists/admin/actions/processqueue.php
+++ b/public_html/lists/admin/actions/processqueue.php
@@ -897,6 +897,12 @@ function sendEmailTest($messageid, $email)
);
}
+ //# this allows plugins to change the order in which the subscribers are
+ //# processed, by adding an "order by" clause to the query
+ foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
+ $query = $plugin->processQueueUserSelectQuery($query, $messageid);
+ }
+
if (VERBOSE) {
processQueueOutput('User select query '.$query);
}
@@ -938,6 +944,9 @@ function sendEmailTest($messageid, $email)
//# rerun the initial query, in order to continue as normal
$query = sprintf('select userid from '.$tables['usermessage'].' where messageid = %d and status = "todo"',
$messageid);
+ foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
+ $query = $plugin->processQueueUserSelectQuery($query, $messageid);
+ }
$userids = Sql_Query($query);
$counters['total_users_for_message '.$messageid] = Sql_Affected_Rows();
}
diff --git a/public_html/lists/admin/defaultplugin.php b/public_html/lists/admin/defaultplugin.php
index 2995b150a..5df3a45a0 100644
--- a/public_html/lists/admin/defaultplugin.php
+++ b/public_html/lists/admin/defaultplugin.php
@@ -848,6 +848,22 @@ public function processQueueStart()
{
}
+ /**
+ * processQueueUserSelectQuery
+ * called with the query that selects the subscribers of a campaign, just
+ * before that query is run
+ * allows a plugin to change the order in which subscribers are processed,
+ * for example to interleave imported segments instead of sending in
+ * database order
+ * @param string query the query that is about to be run
+ * @param int messageid the campaign being processed
+ * @return string the query to run
+ */
+ public function processQueueUserSelectQuery($query, $messageid)
+ {
+ return $query;
+ }
+
/**
* allowProcessQueue
* called at the beginning of processQueue