From 57b03d08b9167c7e22760d713ffd32c3fae614fc Mon Sep 17 00:00:00 2001 From: Seth <13510767+ZeroEpoch1969@users.noreply.github.com> Date: Wed, 26 Aug 2020 19:26:54 -0700 Subject: [PATCH] Add new reply parsing --- inc/plugins/staff_only_text.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/inc/plugins/staff_only_text.php b/inc/plugins/staff_only_text.php index 76a0672..07cdade 100644 --- a/inc/plugins/staff_only_text.php +++ b/inc/plugins/staff_only_text.php @@ -5,6 +5,7 @@ if(!defined("IN_MYBB")) } $plugins->add_hook("parse_message", "staff_only_text_run"); +$plugins->add_hook("parse_quoted_message", "parse_new_reply"); function staff_only_text_info() { @@ -14,12 +15,20 @@ global $mybb; "description" => "Staff only viewable text", "author" => "scripthead", "authorsite" => "https://scripthead.me", - "version" => "1.0.0", + "version" => "1.0.1", "codename" => "staff_only_text", "compatibility" => "*", ); } +function parse_new_reply(&$message) +{ + if (!has_permission()) + { + $message = preg_replace('#\[staff\](.*?)\[\/staff\]#si','Only staff may view this text',$message); + } +} + function staff_only_text_activate() { global $mybb, $db; @@ -42,14 +51,13 @@ function staff_only_text_activate() $i = 1; - foreach ($settings as &$row) { + foreach ($settings as &$row) $row['gid'] = $settingGroupId; - $row['title'] = $db->escape_string($row['title']); - $row['description'] = $db->escape_string($row['description']); - $row['disporder'] = $i++; - } + $row['description'] = $db->escape_string($row['description']); + $row['disporder'] = $i++; + } - $db->insert_query_multiple('settings', $settings); + $db->insert_query_multiple('settings', $settings); rebuild_settings(); }