diff --git a/modules/newbb/post.php b/modules/newbb/post.php --- a/modules/newbb/post.php +++ b/modules/newbb/post.php @@ -190,2 +190,19 @@ if (Request::getString('contents_submit', '', 'POST')) { $approved = $topicHandler->getPermission($forumObject, $topic_status, 'noapprove'); + + // Stable extension point for per-topic reply moderation. The companion + // module owns all policy and storage; NewBB only exposes this context. + defined('TOPICMODERATION_NEWBB_BRIDGE_VERSION') || define('TOPICMODERATION_NEWBB_BRIDGE_VERSION', 2); + if (isset($GLOBALS['xoopsPreload']) && is_object($GLOBALS['xoopsPreload'])) { + $approvalContext = [ + 'approved' => &$approved, + 'topic_id' => (int)$topic_id, + 'forum_id' => (int)$forumObject->getVar('forum_id'), + 'post_id' => (int)$post_id, + 'is_edit' => !empty($isedit), + 'is_topic_post'=> $postObject->isTopic(), + 'is_admin' => !empty($isAdmin), + ]; + $GLOBALS['xoopsPreload']->triggerEvent('module.newbb.post.approval', $approvalContext); + unset($approvalContext); + } $postObject->setVar('approved', $approved); @@ -400,2 +417,14 @@ if (Request::getString('contents_submit', '', 'POST')) { $message = _MD_NEWBB_THANKSSUBMIT . '
' . _MD_NEWBB_WAITFORAPPROVAL . '
' . $error_upload; + + if (isset($GLOBALS['xoopsPreload']) && is_object($GLOBALS['xoopsPreload'])) { + $pendingMessageContext = [ + 'message' => &$message, + 'redirect' => &$redirect, + 'topic_id' => (int)$postObject->getVar('topic_id'), + 'post_id' => (int)$postid, + 'is_admin' => !empty($isAdmin), + ]; + $GLOBALS['xoopsPreload']->triggerEvent('module.newbb.post.pending.message', $pendingMessageContext); + unset($pendingMessageContext); + } }