Closed WildcardSearch closed 11 years ago
if ($settings['myalerts_enabled'] AND $settings['myalerts_alert_editpost'])
{
$plugins->add_hook('editpost_do_editpost_end', 'myalertsmore_addAlert_editpost');
$plugins->add_hook('xmlhttp_do_quickedit', 'myalertsmore_addAlert_editpost_quick');
}
// full edit
function myalertsmore_addAlert_editpost()
{
global $mybb, $Alerts, $post;
// we need to check a few things, retrieve data
$postinfo = get_post($post['pid']);
// check if post belongs to the user itself. Is it not? Then alert the user!
if($postinfo['uid'] != $mybb->user['uid'])
{
$Alerts->addAlert((int) $postinfo['uid'], 'editpost', (int) $postinfo['tid'], (int) $mybb->user['uid'], array(
'pid' => $post['pid'],
'tid' => $postinfo['tid'],
));
}
}
// quick edit
function myalertsmore_addAlert_editpost_quick()
{
global $mybb, $Alerts, $post;
// check if post belongs to the user itself. Is it not? Then alert the user!
if($post['uid'] != $mybb->user['uid'])
{
$Alerts->addAlert((int) $post['uid'], 'editpost', (int) $post['tid'], (int) $mybb->user['uid'], array(
'pid' => $post['pid'],
'tid' => $post['tid'],
));
}
}
This is what I use in Moderation Alerts Pack to deal with quick & full reply. Should be easily editable to include a "Did he add any mention?" check. I'd recommend making a standalone mentions_check($message)
function to extend a little bit the plugin, just a suggestion though.
Thanks a lot shade. I used the datahandler hook and could only get Full Edit to work. Will check it out and report.
Thanks so much.
Done. Thanks to @Shade- for all your help.
Tecca from TESOF reported that editing a post to add a mention (quick edit or full edit) doesn't alert the user mentioned.