wp_notify_moderator example

// Only send notifications for pending comments.     $maybe_notify = ( '0' == $comment->comment_approved );

    /** This filter is documented in wp-includes/pluggable.php */
    $maybe_notify = apply_filters( 'notify_moderator', $maybe_notify$comment_id );

    if ( ! $maybe_notify ) {
        return false;
    }

    return wp_notify_moderator( $comment_id );
}

/** * Sends a notification of a new comment to the post author. * * @since 4.4.0 * * Uses the {@see 'notify_post_author'} filter to determine whether the post author * should be notified when a new comment is added, overriding site setting. * * @param int $comment_id Comment ID. * @return bool True on success, false on failure. */
// make sure the comment status is still pending. if it isn't, that means the user has already moved it elsewhere.                 $comment = get_comment( $comment_id );
                if ( $comment && 'unapproved' == wp_get_comment_status( $comment_id ) ) {
                    if ( $status == 'true' ) {
                        wp_spam_comment( $comment_id );
                    } elseif ( $status == 'false' ) {
                        // comment is good, but it's still in the pending queue. depending on the moderation settings                         // we may need to change it to approved.                         if ( check_comment($comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent, $comment->comment_type) )
                            wp_set_comment_status( $comment_id, 1 );
                        else if ( get_comment_meta( $comment_id, 'akismet_delayed_moderation_email', true ) )
                            wp_notify_moderator( $comment_id );
                    }
                }
                
                delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' );
            } else {
                // If this comment has been pending moderation for longer than MAX_DELAY_BEFORE_MODERATION_EMAIL,                 // send a moderation email now.                 if ( ( intval( gmdate( 'U' ) ) - strtotime( $comment->comment_date_gmt ) ) < self::MAX_DELAY_BEFORE_MODERATION_EMAIL ) {
                    delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' );
                    wp_notify_moderator( $comment_id );
                }

                
Home | Imprint | This part of the site doesn't use cookies.