public function renderCheckActions()
{
$action = $this->wire('input')->get('comment_success');
if (empty($action) || $action === "1") {
return '';
}
if ($action === '2' || $action === '3') {
$message = $this->wire('session')->get('CommentApprovalMessage');
if ($message) {
$this->wire('session')->remove('CommentApprovalMessage');
$class = $action === '2' ? 'success' : 'error';
$commentID = (int) $this->wire('input')->get('comment_id');
$message = $this->wire('sanitizer')->entities($message);
if ($commentID) {
$message = str_replace($commentID, "<a href='#Comment{$commentID}'>{$commentID}</a>", $message);
}
return "<p id='CommentApprovalMessage' class='{$class}'><strong>{$message}</strong></p>";
}
}
if (!$this->field) {
return '';
}
require_once dirname(__FILE__) . '/CommentNotifications.php';
$no = new CommentNotifications($this->page, $this->field);
$info = $no->checkActions();
if ($info['valid']) {
$url = $this->page->url . '?';
if ($info['commentID']) {
$url .= "comment_id={$info['commentID']}&";
}
$url .= "comment_success=" . ($info['success'] ? '2' : '3');
$this->wire('session')->set('CommentApprovalMessage', $info['message']);
$this->wire('session')->redirect($url . '#CommentApprovalMessage');
}
return '';
}