Plugin Directory

Changeset 3139326


Ignore:
Timestamp:
08/21/2024 10:58:34 PM (19 months ago)
Author:
mdawaffe
Message:

Shift the check for whether the feature is enabled into the post_updated hook rather than the constructor, which fires on init.

Helpful for multisites that may call switch_to_blog() after init.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • email-post-changes/trunk/class.email-post-changes.php

    r3139323 r3139326  
    3333        ) );
    3434
    35         $options = $this->get_options();
    36 
    37         if ( $options['enable'] ) {
    38             add_action( 'post_updated', array( $this, 'post_updated' ), 10, 3 );
    39             add_action( 'epc_new_bbpress_item', array( $this, 'post_updated' ), 10, 3 );  // Support for bbPress 2
    40         }
     35        add_action( 'post_updated', array( $this, 'post_updated' ), 10, 3 );
     36        add_action( 'epc_new_bbpress_item', array( $this, 'post_updated' ), 10, 3 );  // Support for bbPress 2
    4137
    4238        if ( current_user_can( 'manage_options' ) ) {
     
    7369
    7470        $options = $this->get_options();
     71        if ( ! $options['enable'] ) {
     72            return;
     73        }
    7574
    7675        // Transitioning from an Auto Draft to Published shouldn't result in a notification.
Note: See TracChangeset for help on using the changeset viewer.