Making WordPress.org

Changeset 4048


Ignore:
Timestamp:
09/13/2016 06:25:56 PM (8 years ago)
Author:
jmdodd
Message:

Support Forums: Remove topic/reply author from subscription email list.

Moves bail on other action to first step of subscription handler.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-term-subscription/inc/class-plugin.php

    r4005 r4048  
    5959     */
    6060    public function term_subscribe_handler( $action = '' ) {
    61         if ( ! $this->taxonomy ) {
    62             return;
    63         }
    64 
    65         // Taxonomy mismatch; a different instance should handle this.
    66         if ( $this->taxonomy != $_GET['taxonomy'] ) {
    67             return;
    68         }
    69 
    70         if ( ! bbp_is_subscriptions_active() ) {
    71             return false;
    72         }
    73 
    7461        // Bail if the actions aren't meant for this function.
    7562        if ( ! in_array( $action, self::get_valid_actions() ) ) {
     
    7764        }
    7865
     66        if ( ! $this->taxonomy ) {
     67            return;
     68        }
     69
     70        // Taxonomy mismatch; a different instance should handle this.
     71        if ( ! isset( $_GET['taxonomy'] ) || $this->taxonomy != $_GET['taxonomy'] ) {
     72            return;
     73        }
     74
     75        if ( ! bbp_is_subscriptions_active() ) {
     76            return false;
     77        }
     78
     79        // Bail if the actions aren't meant for this function.
     80        if ( ! in_array( $action, self::get_valid_actions() ) ) {
     81            return;
     82        }
     83
    7984        // Bail if no term id is passed.
    80         if ( empty( $_GET['term_id'] ) || empty( $_GET['taxonomy'] ) ) {
     85        if ( ! isset( $_GET['term_id'] ) || empty( $_GET['term_id'] ) ) {
    8186            return;
    8287        }
     
    160165        }
    161166
     167        // Remove the author from being notified of their own topic.
     168        $this->subscribers = array_diff( $this->subscribers, array( bbp_get_topic_author_id( $topic_id ) ) );
     169
    162170        if ( empty( $this->subscribers ) ) {
    163171            return;
     
    252260            $this->subscribers = array_diff( $this->subscribers, $topic_subscribers );
    253261        }
     262
     263        // Remove the author from being notified of their own reply.
     264        $this->subscribers = array_diff( $this->subscribers, array( bbp_get_reply_author_id( $reply_id ) ) );
    254265
    255266        if ( empty( $this->subscribers ) ) {
Note: See TracChangeset for help on using the changeset viewer.