Opened 15 years ago
Closed 15 years ago
#14878 closed enhancement (fixed)
wp_get_current_commenter filter
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Comments | Keywords: | |
Focuses: | Cc: |
Description
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 might * 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 = $_COOKIE['comment_author_email_'.COOKIEHASH]; $comment_author_url = ''; if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) $comment_author_url = $_COOKIE['comment_author_url_'.COOKIEHASH]; 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.
Change History (3)
Note: See
TracTickets for help on using
tickets.
This isn't a blessed task.