Making WordPress.org


Ignore:
Timestamp:
09/21/2020 07:45:29 PM (4 years ago)
Author:
coffee2code
Message:

Developer, User Content: Disable moderation emails to post author for parsed post types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content.php

    r10000 r10280  
    7373        // Disable the search query in the insert link modal window
    7474        add_filter( 'wp_link_query_args',              array( __CLASS__, 'disable_link_query' ) );
     75
     76        // Disable moderation emails to post author.
     77        add_filter( 'comment_notification_recipients', array( __CLASS__, 'disable_moderation_emails' ), 10, 2 );
    7578    }
    7679
     
    510513    }
    511514
     515    /**
     516     * Disables moderation emails to post author for parsed post types.
     517     *
     518     * Parsed post types aren't legitimately authored by any given user, so whoever
     519     * is assigned does not need these notifications. A team of moderators are
     520     * responsible for handling submitted comments, most of which start off in
     521     * moderation.
     522     *
     523     * @param string[] $emails     An array of email addresses to receive a comment notification.
     524     * @param int      $comment_id The comment ID.
     525     */
     526    public static function disable_comment_notifications( $emails, $comment_id ) {
     527        $comment = get_comment( $comment_id );
     528
     529        if ( $comment && DevHub\is_parsed_post_type( get_post_type( $comment->comment_post_ID ) ) ) {
     530            $emails = [];
     531        }
     532
     533        return $emails;
     534    }
     535   
    512536} // DevHub_User_Submitted_Content
    513537
Note: See TracChangeset for help on using the changeset viewer.