Add new reply parsing

This commit is contained in:
Seth 2020-08-26 19:26:54 -07:00
parent db349641e7
commit 57b03d08b9
No known key found for this signature in database
GPG key ID: A7BAB4E14F089CF3

View file

@ -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,9 +51,8 @@ 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++;
}