comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT $bfa_rc_src_count"; $comments = $wpdb->get_results($sql); // Generate the output string, prepend and append the HTML specified $output = $bfa_rc_pre_HTML; $output .= "\n"; $output .= $bfa_rc_post_HTML; // remove empty author links $output = preg_replace("/(.*?)<\/a>/i","\\2",$output); $output = preg_replace("/(.*?)<\/a>/i","\\2",$output); // These lines generate the output echo $before_widget . $before_title . $bfa_rc_title . $after_title; echo $output; echo $after_widget; } } // This is the function that outputs the form to let the users edit // the widget's parameters. function widget_simple_recent_comments_control() { // Fetch the options, check them and if need be, update the options array $bfa_rc_options = $bfa_rc_newoptions = get_option('widget_simple_recent_comments'); if ( $_POST["bfa_rc_src-submit"] ) { $bfa_rc_newoptions['bfa_rc_title'] = strip_tags(stripslashes($_POST["bfa_rc_src-title"])); $bfa_rc_newoptions['bfa_rc_src_count'] = (int) $_POST["bfa_rc_src_count"]; $bfa_rc_newoptions['bfa_rc_src_length'] = (int) $_POST["bfa_rc_src_length"]; $bfa_rc_newoptions['bfa_rc_linking_scheme'] = strip_tags(stripslashes($_POST["bfa_rc_linking_scheme"])); $bfa_rc_newoptions['point_first_link'] = $_POST["point_first_link"]; $bfa_rc_newoptions['point_second_link'] = $_POST["point_second_link"]; # $bfa_rc_newoptions['add_dots'] = $_POST["add_dots"]; $bfa_rc_newoptions['add_dots'] = !isset($_POST["add_dots"]) ? NULL : $_POST["add_dots"]; $bfa_rc_newoptions['limit_by'] = $_POST["limit_by"]; $bfa_rc_newoptions['author_bold'] = !isset($_POST["author_bold"]) ? NULL : $_POST["author_bold"]; $bfa_rc_newoptions['author_em'] = !isset($_POST["author_em"]) ? NULL : $_POST["author_em"]; $bfa_rc_newoptions['comment_bold'] = !isset($_POST["comment_bold"]) ? NULL : $_POST["comment_bold"]; $bfa_rc_newoptions['comment_em'] = !isset($_POST["comment_em"]) ? NULL : $_POST["comment_em"]; $bfa_rc_newoptions['post_bold'] = !isset($_POST["post_bold"]) ? NULL : $_POST["post_bold"]; $bfa_rc_newoptions['post_em'] = !isset($_POST["post_em"]) ? NULL : $_POST["post_em"]; $bfa_rc_newoptions['author_nofollow'] = !isset($_POST["author_nofollow"]) ? NULL : $_POST["author_nofollow"]; $bfa_rc_newoptions['bfa_rc_display_homepage'] = !isset($_POST["bfa_rc_display_homepage"]) ? NULL : $_POST["bfa_rc_display_homepage"]; $bfa_rc_newoptions['bfa_rc_display_category'] = !isset($_POST["bfa_rc_display_category"]) ? NULL : $_POST["bfa_rc_display_category"]; $bfa_rc_newoptions['bfa_rc_display_post'] = !isset($_POST["bfa_rc_display_post"]) ? NULL : $_POST["bfa_rc_display_post"]; $bfa_rc_newoptions['bfa_rc_display_page'] = !isset($_POST["bfa_rc_display_page"]) ? NULL : $_POST["bfa_rc_display_page"]; $bfa_rc_newoptions['bfa_rc_display_archive'] = !isset($_POST["bfa_rc_display_archive"]) ? NULL : $_POST["bfa_rc_display_archive"]; $bfa_rc_newoptions['bfa_rc_display_tag'] = !isset($_POST["bfa_rc_display_tag"]) ? NULL : $_POST["bfa_rc_display_tag"]; $bfa_rc_newoptions['bfa_rc_display_search'] = !isset($_POST["bfa_rc_display_search"]) ? NULL : $_POST["bfa_rc_display_search"]; $bfa_rc_newoptions['bfa_rc_display_author'] = !isset($_POST["bfa_rc_display_author"]) ? NULL : $_POST["bfa_rc_display_author"]; $bfa_rc_newoptions['bfa_rc_display_404'] = !isset($_POST["bfa_rc_display_404"]) ? NULL : $_POST["bfa_rc_display_404"]; } if ( $bfa_rc_options != $bfa_rc_newoptions ) { $bfa_rc_options = $bfa_rc_newoptions; update_option('widget_simple_recent_comments', $bfa_rc_options); } // Default options to the parameters if ( !$bfa_rc_options['bfa_rc_src_count'] ) $bfa_rc_options['bfa_rc_src_count'] = 7; if ( !$bfa_rc_options['bfa_rc_src_length'] ) $bfa_rc_options['bfa_rc_src_length'] = 60; if ( !$bfa_rc_options['bfa_rc_linking_scheme'] ) $bfa_rc_options['bfa_rc_linking_scheme'] = "Author Comment link-all"; if ( !$bfa_rc_options['point_first_link'] ) $bfa_rc_options['point_first_link'] = "author"; if ( !$bfa_rc_options['point_second_link'] ) $bfa_rc_options['point_second_link'] = "comment"; if ( !$bfa_rc_options['limit_by'] ) $bfa_rc_options['limit_by'] = "letters"; if ( !$bfa_rc_options['author_nofollow'] ) $bfa_rc_options['author_nofollow'] = "on"; $bfa_rc_src_count = $bfa_rc_options['bfa_rc_src_count']; $bfa_rc_src_length = $bfa_rc_options['bfa_rc_src_length']; $bfa_rc_linking_scheme = $bfa_rc_options['bfa_rc_linking_scheme']; $point_first_link = $bfa_rc_options['point_first_link']; $point_second_link = $bfa_rc_options['point_second_link']; $add_dots = $bfa_rc_options['add_dots']; $limit_by = $bfa_rc_options['limit_by']; $author_bold = $bfa_rc_options['author_bold']; $author_em = $bfa_rc_options['author_em']; $comment_bold = $bfa_rc_options['comment_bold']; $comment_em = $bfa_rc_options['comment_em']; $post_bold = $bfa_rc_options['post_bold']; $post_em = $bfa_rc_options['post_em']; $author_nofollow = $bfa_rc_options['author_nofollow']; $bfa_rc_display_homepage = $bfa_rc_options['bfa_rc_display_homepage']; $bfa_rc_display_category = $bfa_rc_options['bfa_rc_display_category']; $bfa_rc_display_post = $bfa_rc_options['bfa_rc_display_post']; $bfa_rc_display_page = $bfa_rc_options['bfa_rc_display_page']; $bfa_rc_display_archive = $bfa_rc_options['bfa_rc_display_archive']; $bfa_rc_display_tag = $bfa_rc_options['bfa_rc_display_tag']; $bfa_rc_display_search = $bfa_rc_options['bfa_rc_display_search']; $bfa_rc_display_author = $bfa_rc_options['bfa_rc_display_author']; $bfa_rc_display_404 = $bfa_rc_options['bfa_rc_display_404']; // Deal with HTML in the parameters $bfa_rc_pre_HTML = htmlspecialchars($bfa_rc_options['bfa_rc_pre_HTML'], ENT_QUOTES); $bfa_rc_post_HTML = htmlspecialchars($bfa_rc_options['bfa_rc_post_HTML'], ENT_QUOTES); $bfa_rc_title = htmlspecialchars($bfa_rc_options['bfa_rc_title'], ENT_QUOTES); ?> Title:

Show comments like this:

/> Author Name: Comment Text

/> Author Name: Comment Text

/> Author Name: Comment Text

/> Author Name: Comment Text

/> Author Name on: Post Title

/> Author Name on: Post Title

/> Author Name on: Post Title

/> Author Name on: Post Title

/> Post Title: Comment Text

/> Post Title: Comment Text

/> Post Title: Comment Text

/> Post Title: Comment Text


Point the first link to:

/> the author's homepage (if any)

/> the comments

/> the post

Point the second link (if any) to:

/> the author's homepage (if any)

/> the comments

/> the post


/> Set the link to the Author Homepage to "Nofollow"


Limit the comment text to /> letters /> words.    /> add "..." if the actual comment is longer than that.


Make the Author Name /> Bold /> Emphasized

Make the Comment Text /> Bold /> Emphasized

Make the Post Title /> Bold /> Emphasized


Display the list on:

/> Homepage

/> Category Pages

/> Single Post Pages

/> "Page" Pages

/> Archive Pages

/> Tag Pages

/> Search Result Pages

/> Author Pages

/> 404 Not Found Pages