aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2015-02-02 23:09:34 +0100
committerJoas Schilling <nickvergessen@gmx.de>2015-02-02 23:09:34 +0100
commit0aea283ab021d3bffbc7bc3152764d4ece63334c (patch)
tree93d497a0a9773aaa45656be55bba2b665efe7842 /phpBB/includes/functions.php
parentb1336ae01600b0ff6fdc9272d9c244bb3e9e14db (diff)
parentb88b8305fd6f25d6726bcdbb9fb1fe68cf6b1315 (diff)
downloadforums-0aea283ab021d3bffbc7bc3152764d4ece63334c.tar
forums-0aea283ab021d3bffbc7bc3152764d4ece63334c.tar.gz
forums-0aea283ab021d3bffbc7bc3152764d4ece63334c.tar.bz2
forums-0aea283ab021d3bffbc7bc3152764d4ece63334c.tar.xz
forums-0aea283ab021d3bffbc7bc3152764d4ece63334c.zip
Merge pull request #3305 from Wolfsblvt/ticket/13518
Add core event to markread() in functions.php
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php35
1 files changed, 34 insertions, 1 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 97429a0be4..c00169af88 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1150,10 +1150,43 @@ function phpbb_timezone_select($template, $user, $default = '', $truncate = fals
function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $user_id = 0)
{
global $db, $user, $config;
- global $request, $phpbb_container;
+ global $request, $phpbb_container, $phpbb_dispatcher;
$post_time = ($post_time === 0 || $post_time > time()) ? time() : (int) $post_time;
+ $should_markread = true;
+
+ /**
+ * This event is used for performing actions directly before marking forums,
+ * topics or posts as read.
+ *
+ * It is also possible to prevent the marking. For that, the $should_markread parameter
+ * should be set to FALSE.
+ *
+ * @event core.markread_before
+ * @var string mode Variable containing marking mode value
+ * @var mixed forum_id Variable containing forum id, or false
+ * @var mixed topic_id Variable containing topic id, or false
+ * @var int post_time Variable containing post time
+ * @var int user_id Variable containing the user id
+ * @var bool should_markread Flag indicating if the markread should be done or not.
+ * @since 3.1.4-RC1
+ */
+ $vars = array(
+ 'mode',
+ 'forum_id',
+ 'topic_id',
+ 'post_time',
+ 'user_id',
+ 'should_markread',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.markread_before', compact($vars)));
+
+ if (!$should_markread)
+ {
+ return;
+ }
+
if ($mode == 'all')
{
if ($forum_id === false || !sizeof($forum_id))