function comments_render_comment

6.x comments.module comments_render_comment($comment, $delete_link = "")
4.x comments.module comments_render_comment($comment, $delete_link = "")
5.x comments.module comments_render_comment($comment, $delete_link = "")

Display the comment array in a pretty way.

3 calls to comments_render_comment()
comments_display_main in modules/comments/comments.module
This displays the primary Comments tab, where we see past comments and can enter a new one (with the right permissions).
comments_popup_display_all_comments in modules/comments/comments.module
Displays all comments for a student in a popup window, meant for printing.
comments_popup_display_comment in modules/comments/comments.module

File

modules/comments/comments.module, line 280

Code

function comments_render_comment($comment, $delete_link = "") {
  $rtn = "";

  // Make sure the user has access to view it!
  if (!user_has_permission("view_comments")) {
    return "<p>" . t("Sorry, you do not have permission to view comments.") . "</p>";
  }
  if ($comment ["access_type"] == "faculty" && !user_has_permission("view_faculty_comments")) {
    return "<p>" . t("Sorry, but you do not have permission to view the requested comment (it is marked as faculty-only).") . "</p>";
  }


  $rtn .= "<div class='comment-comment comment-comment-" . $comment ["access_type"] . "'>
              <div class='comment-by-line'>" . ucwords($comment ["access_type"]) . " " . t("comment by") . " " . fp_get_faculty_name($comment ["faculty_id"]) . "</div>
              <div class='comment-datetime'>" . format_date($comment ["posted"], "pretty") . "</div>
              <div class='comment-text'>" . filter_markup($comment ["comment"], "full") . "</div>
              ";
  if ($delete_link) {
    $rtn .= "<div class='comment-delete'>$delete_link</div>";
  }
  $rtn .= "
            </div>";


  return $rtn;
}