comment_post_ID); $user = get_userdata( $post->post_author ); // If there's no email to send the comment to if ('' == $user->user_email) return false; $comment_author_domain = @gethostbyaddr($comment->comment_author_IP); $blogname = get_settings('blogname'); if ('comment' == $comment_type || empty( $comment_type ) ) { $notify_message = sprintf( __('The entry "%s" was recently commented upon:'), $post->post_title ) . "\n"; $notify_message .= "<" . get_permalink($comment->comment_post_ID) . ">\n\n"; $notify_message .= sprintf( __('Author : %s'), $comment->comment_author ) . "\n"; $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\n"; $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\n"; $notify_message .= __('Comment: ') . "\n--------\n" . $comment->comment_content . "\n--------\n\n-- \n"; $notify_message .= sprintf( __('IP : %1$s , %2$s'), $comment->comment_author_IP, $comment_author_domain ) . "\n"; $notify_message .= sprintf( __('Whois : comment_author_IP ) . ">\n\n"; $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title ); } elseif('trackback' == $comment_type || 'pingback' == $comment_type) { $notify_message = sprintf( __('The entry "%s" was recetly pinged:'), $post->post_title ) . "\n"; $notify_message .= "<" . get_permalink($comment->comment_post_ID) . ">\n\n"; $notify_message .= sprintf( __('Website: %s'), $comment->comment_author ) . "\n"; $notify_message .= sprintf( __('IP : %1$s , %2$s'), $comment->comment_author_IP, $comment_author_domain ) . "\n"; $notify_message .= sprintf( __('URI : <%s>'), $comment->comment_author_url ) . "\n"; $notify_message .= __('Excerpt: ') . "\n--------\n" . $comment->comment_content . "\n--------\n\n-- \n"; $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title ); } $notify_message .= sprintf( __('Edit : <%s>'), get_settings('siteurl').'/wp-admin/comment.php?action=editcomment&c='.$comment->comment_ID ) . "\n"; $notify_message .= sprintf( __('Spam : <%s>'), get_settings('siteurl')."/wp-admin/comment.php?action=cdc&dt=spam&c=$comment_id" ) . "\n"; $notify_message .= sprintf( __('Delete: <%s>'), get_settings('siteurl')."/wp-admin/comment.php?action=cdc&c=$comment_id" ) . "\n"; $notify_message .= sprintf( __('All : <%s>'), get_settings('siteurl').'/wp-admin/edit.php?p=' . $post->ID . '&c=1') . "\n"; $notify_message = str_replace("\r", '', $notify_message); $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); if ( '' == $comment->comment_author ) { $from = "From: \"$blogname\" <$wp_email>"; if ( '' != $comment->comment_author_email ) $reply_to = "Reply-To: $comment->comment_author_email"; } else { $from = "From: \"$comment->comment_author\" <$wp_email>"; if ( '' != $comment->comment_author_email ) $reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>"; } $message_headers = "MIME-Version: 1.0\n" . "$from\n" . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; if ( isset($reply_to) ) $message_headers .= $reply_to . "\n"; $notify_message = apply_filters('comment_notification_text', $notify_message, $comment_id); $subject = apply_filters('comment_notification_subject', $subject, $comment_id); $message_headers = apply_filters('comment_notification_headers', $message_headers, $comment_id); @wp_mail($user->user_email, $subject, $notify_message, $message_headers); return true; } endif; /* function: wp_notify_moderator changes : * (0.1) sped up $post selection from database * (0.1) modified layout of email to more clearly show the comment and approve/delete links * (0.1) moved IP address information to bottom * (0.1) added link to entry comments page (edit.php?p=####&c=1) * (0.11) removed &p= from three of the URLs (commented out) * (0.3) WordPress 2.1 support with new URLs added */ if ( !function_exists('wp_notify_moderator') ) : function wp_notify_moderator($comment_id) { global $wpdb; if( get_option( "moderation_notify" ) == 0 ) return true; $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); $post = $wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1"); // $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'"); $comment_author_domain = @gethostbyaddr($comment->comment_author_IP); $notify_message = sprintf( __('A new comment on "%s" is waiting for your approval:'), $post->post_title ) . "\n"; $notify_message .= "<" . get_permalink($comment->comment_post_ID) . ">\n\n"; $notify_message .= sprintf( __('Author : %s'), $comment->comment_author ) . "\n"; $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\n"; $notify_message .= sprintf( __('URI : <%s>'), $comment->comment_author_url ) . "\n"; $notify_message .= __('Comment: ') . "\n--------\n" . $comment->comment_content . "\n--------\n\n-- \n"; $notify_message .= sprintf( __('IP : %1$s , %2$s'), $comment->comment_author_IP, $comment_author_domain ) . "\n"; $notify_message .= sprintf( __('Whois : comment_author_IP ) . ">\n\n"; $notify_message .= sprintf( __('Approve: <%s>'), get_settings('siteurl')."/wp-admin/comment.php?action=mac&c=$comment_id" ) . "\n"; $notify_message .= sprintf( __('Delete : <%s>'), get_settings('siteurl')."/wp-admin/comment.php?action=cdc&c=$comment_id" ) . "\n"; $notify_message .= sprintf( __('Spam : <%s>'), get_settings('siteurl')."/wp-admin/comment.php?action=cdc&dt=spam&c=$comment_id" ) . "\n"; $notify_message .= sprintf( __('Edit : <%s>'), get_settings('siteurl')."/wp-admin/comment.php?action=editcomment&c=$comment_id" ) . "\n\n"; $notify_message .= sprintf( __('All Comments on this entry: <%s>'), get_settings('siteurl').'/wp-admin/edit.php?p='.$post->ID.'&c=1') . "\n"; $subject = sprintf( __('[%1$s] MODERATE: "%2$s"'), get_settings('blogname'), $post->post_title ); $admin_email = get_settings('admin_email'); $notify_message = apply_filters('comment_moderation_text', $notify_message, $comment_id); $subject = apply_filters('comment_moderation_subject', $subject, $comment_id); $notify_message = str_replace("\r", '', $notify_message); @wp_mail($admin_email, $subject, $notify_message); return true; } endif; /* function: wp_mail changes : none */ if ( !function_exists('wp_mail') ) : function wp_mail($to, $subject, $message, $headers = '') { if( $headers == '' ) { $headers = "MIME-Version: 1.0\n" . "From: \"".get_settings('blogname')."\" \n" . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; } return @mail($to, $subject, $message, $headers); } endif; ?>