[wp-trac] [WordPress Trac] #14878: wp_get_current_commenter filter

WordPress Trac wp-trac at lists.automattic.com
Wed Sep 15 16:55:36 UTC 2010

#14878: wp_get_current_commenter filter
 Reporter:  louyx           |       Owner:                 
     Type:  task (blessed)  |      Status:  new            
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Comments        |     Version:                 
 Severity:  normal          |    Keywords:                 
 while i was doing something around with the comment system, i've noticed
 that there's no way to change the comment author fields without touching
 the WP original code.

 the problem is with the wp_get_current_commenter function, there's no
 action or filter that can be hooked!

 the best solution i'm thinking about is adding a hook into the
 wp_get_current_commenter function, so it'd become something like:

  * Get current commenter's name, email, and URL.
  * Expects cookies content to already be sanitized. User of this function

  * wish to recheck the returned array for validity.
  * @see sanitize_comment_cookies() Use to sanitize cookies
  * @since 2.0.4
  * @return array Comment author, email, url respectively.

 function wp_get_current_commenter() {
         // Cookies should already be sanitized.

         $comment_author = '';
         if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) )
                 $comment_author = $_COOKIE['comment_author_'.COOKIEHASH];

         $comment_author_email = '';
         if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) )
                 $comment_author_email =

         $comment_author_url = '';

         if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) )
                 $comment_author_url =

         return apply_filters('wp_get_current_commenter',
 compact('comment_author', 'comment_author_email', 'comment_author_url'));


 just applying a filter to the return value, that's all.

Ticket URL: <http://core.trac.wordpress.org/ticket/14878>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list