public static function canAutoApprovalReplyComment($documentId) { $params = JUDownloadHelper::getParams(null, $documentId); $isDocumentOwner = JUDownloadFrontHelperPermission::isDocumentOwner($documentId); $autoApprovalWhenDocumentOwnerReply = $params->get('document_owner_auto_approval_when_reply_comment', 0); if ($isDocumentOwner && $autoApprovalWhenDocumentOwnerReply) { return true; } $user = JFactory::getUser(); $asset = 'com_judownload.document.' . $documentId; if ($user->authorise('judl.comment.reply.auto_approval', $asset)) { return true; } if (!$user->get('guest')) { $autoApprovalReplyThreshold = (int) $params->get('auto_approval_comment_reply_threshold', 0); if ($autoApprovalReplyThreshold > 0) { $totalApprovedRepliesOfUser = JUDownloadFrontHelperComment::getTotalApprovedRepliesOfUser($user->id); if ($totalApprovedRepliesOfUser >= $autoApprovalReplyThreshold) { return true; } } } return false; }