Commit 360c7423 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Allow activity delay to be forced


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 570a9189
......@@ -446,18 +446,20 @@ EOF;
if (is_array($postnow) && !empty($postnow)) {
$values = array();
$postswhere = 'id IN (' . join(',', array_map('intval', $postnow)) . ')';
$delay = false;
}
else {
$currenttime = time();
$minpostdelay = $currenttime - get_config_plugin('interaction', 'forum', 'postdelay') * 60;
$values = array(db_format_timestamp($minpostdelay));
$postswhere = 'ctime < ?';
$delay = null;
}
$posts = get_column_sql('SELECT id FROM {interaction_forum_post} WHERE sent = 0 AND deleted = 0 AND ' . $postswhere, $values);
if ($posts) {
set_field_select('interaction_forum_post', 'sent', 1, 'deleted = 0 AND sent = 0 AND ' . $postswhere, $values);
foreach ($posts as $postid) {
activity_occurred('newpost', array('postid' => $postid), 'interaction', 'forum', (bool) $postnow);
activity_occurred('newpost', array('postid' => $postid), 'interaction', 'forum', $delay);
}
}
}
......
......@@ -34,9 +34,12 @@ defined('INTERNAL') || die();
* @param string $activitytype type of activity
* @param mixed $data data
*/
function activity_occurred($activitytype, $data, $plugintype=null, $pluginname=null, $overridedelay=false) {
function activity_occurred($activitytype, $data, $plugintype=null, $pluginname=null, $delay=null) {
$at = activity_locate_typerecord($activitytype, $plugintype, $pluginname);
if (!empty($at->delay) && !$overridedelay) {
if (is_null($delay)) {
$delay = !empty($at->delay);
}
if ($delay) {
$delayed = new StdClass;
$delayed->type = $at->id;
$delayed->data = serialize($data);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment