mirror of
https://github.com/TotalFreedomMC/StaffOnlyText.git
synced 2024-12-22 15:55:15 +00:00
Add new reply parsing
This commit is contained in:
parent
db349641e7
commit
57b03d08b9
1 changed files with 15 additions and 7 deletions
|
@ -5,6 +5,7 @@ if(!defined("IN_MYBB"))
|
||||||
}
|
}
|
||||||
|
|
||||||
$plugins->add_hook("parse_message", "staff_only_text_run");
|
$plugins->add_hook("parse_message", "staff_only_text_run");
|
||||||
|
$plugins->add_hook("parse_quoted_message", "parse_new_reply");
|
||||||
|
|
||||||
function staff_only_text_info()
|
function staff_only_text_info()
|
||||||
{
|
{
|
||||||
|
@ -14,12 +15,20 @@ global $mybb;
|
||||||
"description" => "Staff only viewable text",
|
"description" => "Staff only viewable text",
|
||||||
"author" => "scripthead",
|
"author" => "scripthead",
|
||||||
"authorsite" => "https://scripthead.me",
|
"authorsite" => "https://scripthead.me",
|
||||||
"version" => "1.0.0",
|
"version" => "1.0.1",
|
||||||
"codename" => "staff_only_text",
|
"codename" => "staff_only_text",
|
||||||
"compatibility" => "*",
|
"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()
|
function staff_only_text_activate()
|
||||||
{
|
{
|
||||||
global $mybb, $db;
|
global $mybb, $db;
|
||||||
|
@ -42,14 +51,13 @@ function staff_only_text_activate()
|
||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
|
|
||||||
foreach ($settings as &$row) {
|
foreach ($settings as &$row)
|
||||||
$row['gid'] = $settingGroupId;
|
$row['gid'] = $settingGroupId;
|
||||||
$row['title'] = $db->escape_string($row['title']);
|
$row['description'] = $db->escape_string($row['description']);
|
||||||
$row['description'] = $db->escape_string($row['description']);
|
$row['disporder'] = $i++;
|
||||||
$row['disporder'] = $i++;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$db->insert_query_multiple('settings', $settings);
|
$db->insert_query_multiple('settings', $settings);
|
||||||
|
|
||||||
rebuild_settings();
|
rebuild_settings();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue