echo $oublogoutput->render_comments($post, $oublog, $canaudit, $canmanagecomments, false, $cm); } echo '</div>'; // If it is your own post, then see if there are any moderated comments - // for security reasons, you must also be allowed to comment on the post in // order to moderate it (because 'approving' a comment is basically equivalent // to commenting). // Logic should be if public comments are allowed and, // either post user and can comment, or can manage comments. $includeset = $canaudit; if ($post->allowcomments >= OUBLOG_COMMENTS_ALLOWPUBLIC && ($post->userid == $USER->id && oublog_can_comment($cm, $oublog, $post) || $canmanagecomments)) { // Also, if this is a personal global blog include accepted/rejected comments. if ($oublog->global) { $includeset = true; } $moderated = oublog_get_moderated_comments($oublog, $post, $includeset); $display = array(); foreach ($moderated as $comment) { if ($comment->approval != OUBLOG_MODERATED_APPROVED) { $display[] = $comment; } } if (count($display)) { print '<h2 id="awaiting">' . get_string('moderated_awaiting', 'oublog') . '</h2>'; print '<p>' . get_string('moderated_awaitingnote', 'oublog') . '</p>'; print '<div class="oublog-awaiting">'; foreach ($display as $comment) { if ($comment->approval == OUBLOG_MODERATED_APPROVED) { continue; // Don't bother showing approved comments as they // appear above.
} } ?> </div> </div> <?php } } // Note: This section is indented correctly. For now, I left the rest of the // code with the incorrect initial indent // If it is your own post, then see if there are any moderated comments - // for security reasons, you must also be allowed to comment on the post in // order to moderate it (because 'approving' a comment is basically equivalent // to commenting) if ($post->userid == $USER->id && $post->allowcomments >= OUBLOG_COMMENTS_ALLOWPUBLIC && oublog_can_comment($cm, $oublog, $post)) { $moderated = oublog_get_moderated_comments($oublog, $post, $canaudit); $display = array(); foreach ($moderated as $comment) { if ($comment->approval != OUBLOG_MODERATED_APPROVED) { $display[] = $comment; } } if (count($display)) { print '<h2 id="awaiting">' . get_string('moderated_awaiting', 'oublog') . '</h2>'; print '<p>' . get_string('moderated_awaitingnote', 'oublog') . '</p>'; print '<div class="oublog-awaiting">'; foreach ($display as $comment) { if ($comment->approval == OUBLOG_MODERATED_APPROVED) { continue; // Don't bother showing approved comments as they // appear above