Deprecate the second argument for wp_notify_postauthor because it is unecessary. Fixes #17862 props scribu and wonderboymusic.

Built from https://develop.svn.wordpress.org/trunk@26358


git-svn-id: http://core.svn.wordpress.org/trunk@26259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Westwood 2013-11-24 16:26:10 +00:00
parent c620366940
commit bca9252522
2 changed files with 18 additions and 11 deletions

View File

@ -1414,13 +1414,17 @@ function wp_new_comment( $commentdata ) {
do_action('comment_post', $comment_ID, $commentdata['comment_approved']);
if ( 'spam' !== $commentdata['comment_approved'] ) { // If it's spam save it silently for later crunching
if ( '0' == $commentdata['comment_approved'] )
if ( '0' == $commentdata['comment_approved'] ) {
wp_notify_moderator( $comment_ID );
}
$post = get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
if ( get_option('comments_notify') && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) )
wp_notify_postauthor($comment_ID, isset( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' );
if ( get_option('comments_notify') && $commentdata['comment_approved'] ) {
$post = get_post( $commentdata['comment_post_ID'] );
// Don't notify if it's your own comment
if ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) {
wp_notify_postauthor( $comment_ID );
}
}
}
return $comment_ID;
@ -1453,8 +1457,7 @@ function wp_set_comment_status($comment_id, $comment_status, $wp_error = false)
case '1':
$status = '1';
if ( get_option('comments_notify') ) {
$comment = get_comment($comment_id);
wp_notify_postauthor($comment_id, $comment->comment_type);
wp_notify_postauthor( $comment_id );
}
break;
case 'spam':

View File

@ -1005,10 +1005,14 @@ if ( ! function_exists('wp_notify_postauthor') ) :
* @since 1.0.0
*
* @param int $comment_id Comment ID
* @param string $comment_type Optional. The comment type either 'comment' (default), 'trackback', or 'pingback'
* @param string $deprecated Not used
* @return bool False if user email does not exist. True on completion.
*/
function wp_notify_postauthor( $comment_id, $comment_type = '' ) {
function wp_notify_postauthor( $comment_id, $deprecated = null ) {
if ( null !== $deprecated ) {
_deprecated_argument( __FUNCTION__, '3.8' );
}
$comment = get_comment( $comment_id );
if ( empty( $comment ) )
return false;
@ -1038,7 +1042,7 @@ function wp_notify_postauthor( $comment_id, $comment_type = '' ) {
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
if ( empty( $comment_type ) ) $comment_type = 'comment';
$comment_type = $comment->comment_type ? $comment->comment_type : 'comment';
switch ( $comment_type ) {
case 'trackback':