wp_get_current_commenter(): array

Gets current commenter’s name, email, and URL.

Description

Expects cookies content to already be sanitized. User of this function might wish to recheck the returned array for validity.

See also

Return

array An array of current commenter variables.
  • comment_author string
    The name of the current commenter, or an empty string.
  • comment_author_email string
    The email address of the current commenter, or an empty string.
  • comment_author_url string
    The URL address of the current commenter, or an empty string.

Source

 *
 * @param string $new_status The new comment status.
 * @param string $old_status The old comment status.
 */
function _clear_modified_cache_on_transition_comment_status( $new_status, $old_status ) {
	if ( 'approved' === $new_status || 'approved' === $old_status ) {
		$data = array();
		foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
			$data[] = "lastcommentmodified:$timezone";
		}
		wp_cache_delete_multiple( $data, 'timeinfo' );
	}
}

/**
 * Gets current commenter's name, email, and URL.
 *
 * Expects cookies content to already be sanitized. User of this function might
 * wish to recheck the returned array for validity.
 *
 * @see sanitize_comment_cookies() Use to sanitize cookies
 *
 * @since 2.0.4
 *
 * @return array {
 *     An array of current commenter variables.
 *
 *     @type string $comment_author       The name of the current commenter, or an empty string.
 *     @type string $comment_author_email The email address of the current commenter, or an empty string.
 *     @type string $comment_author_url   The URL address of the current commenter, or an empty string.
 * }
 */
function wp_get_current_commenter() {

Changelog

VersionDescription
2.0.4Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.