comment_author_email

Definition:
function comment_author_email( $comment_ID = 0 ) {}

Display the email of the author of the current global $comment.
Care should be taken to protect the email address and assure that email harvesters do not capture your commentors’ email address. Most assume that their email address will not appear in raw form on the blog. Doing so will enable anyone, including those that people don’t want to get the email address and use it for their own means good and bad.

Parameters

  • int $comment_ID: The ID of the comment for which to print the author’s email. Optional.

Defined filters

  • author_email
    apply_filters('author_email', get_comment_author_email( $comment_ID )

Source code

function comment_author_email( $comment_ID = 0 ) {

	echo apply_filters('author_email', get_comment_author_email( $comment_ID ) );

}

663

comment_author

Definition:
function comment_author( $comment_ID = 0 ) {}

Displays the author of the current comment.

Parameters

  • int $comment_ID: The ID of the comment for which to print the author. Optional.

Defined filters

  • comment_author
    apply_filters('comment_author', get_comment_author( $comment_ID )

Source code

function comment_author( $comment_ID = 0 ) {

	$author = apply_filters('comment_author', get_comment_author( $comment_ID ) );

	echo $author;

}

661

comments_template

Definition:
function comments_template( $file = '/comments.php', $separate_comments = false ) {}

Loads the comment template specified in $file.
Will not display the comments template if not on single post or page, or if the post does not have comments.

Parameters

  • string $file: Optional, default ‘/comments.php’. The file to load
  • bool $separate_comments: Optional, whether to separate the comments by comment type. Default is false.

Return values

returns:Returns null if no comments appear

Defined filters

  • comments_array
    apply_filters( 'comments_array', $comments, $post->ID )
  • comments_template
    apply_filters('comments_template', STYLESHEETPATH . $file )

Source code

function comments_template( $file = '/comments.php', $separate_comments = false ) {

	global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage;



	if ( !(is_single() || is_page() || $withcomments) || empty($post) )

		return;



	if ( empty($file) )

		$file = '/comments.php';



	$req = get_option('require_name_email');



	/**

	 * Comment author information fetched from the comment cookies.

	 *

	 * @uses wp_get_current_commenter()

	 */

	$commenter = wp_get_current_commenter();



	/**

	 * The name of the current comment author escaped for use in attributes.

	 */

	$comment_author = $commenter['comment_author']; // Escaped by sanitize_comment_cookies()



	/**

	 * The email address of the current comment author escaped for use in attributes.

	 */

	$comment_author_email = $commenter['comment_author_email'];  // Escaped by sanitize_comment_cookies()



	/**

	 * The url of the current comment author escaped for use in attributes.

	 */

	$comment_author_url = esc_url($commenter['comment_author_url']);



	/** @todo Use API instead of SELECTs. */

	if ( $user_ID) {

		$comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND (comment_approved = '1' OR ( user_id = %d AND comment_approved = '0' ) )  ORDER BY comment_date_gmt", $post->ID, $user_ID));

	} else if ( empty($comment_author) ) {

		$comments = get_comments( array('post_id' => $post->ID, 'status' => 'approve', 'order' => 'ASC') );

	} else {

		$comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND ( comment_approved = '1' OR ( comment_author = %s AND comment_author_email = %s AND comment_approved = '0' ) ) ORDER BY comment_date_gmt", $post->ID, wp_specialchars_decode($comment_author,ENT_QUOTES), $comment_author_email));

	}



	// keep $comments for legacy's sake

	$wp_query->comments = apply_filters( 'comments_array', $comments, $post->ID );

	$comments = &$wp_query->comments;

	$wp_query->comment_count = count($wp_query->comments);

	update_comment_cache($wp_query->comments);



	if ( $separate_comments ) {

		$wp_query->comments_by_type = &separate_comments($comments);

		$comments_by_type = &$wp_query->comments_by_type;

	}



	$overridden_cpage = FALSE;

	if ( '' == get_query_var('cpage') && get_option('page_comments') ) {

		set_query_var( 'cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1 );

		$overridden_cpage = TRUE;

	}



	if ( !defined('COMMENTS_TEMPLATE') || !COMMENTS_TEMPLATE)

		define('COMMENTS_TEMPLATE', true);



	$include = apply_filters('comments_template', STYLESHEETPATH . $file );

	if ( file_exists( $include ) )

		require( $include );

	elseif ( file_exists( TEMPLATEPATH . $file ) )

		require( TEMPLATEPATH .  $file );

	else // Backward compat code will be removed in a future release

		require( ABSPATH . WPINC . '/theme-compat/comments.php');

}

659

comments_rss_link

Definition:
function comments_rss_link($link_text = 'Comments RSS') {}

Print RSS comment feed link.

Parameters

  • string $link_text

Source code

function comments_rss_link($link_text = 'Comments RSS') {

	_deprecated_function( __FUNCTION__, '2.5', 'post_comments_feed_link()' );

	post_comments_feed_link($link_text);

}

657

comments_rss

Definition:
function comments_rss() {}

Return link to the post RSS feed.

Source code

function comments_rss() {

	_deprecated_function( __FUNCTION__, '2.2', 'get_post_comments_feed_link()' );

	return get_post_comments_feed_link();

}

655