WordPress.org

Plugin Directory

Changeset 622281


Ignore:
Timestamp:
11/07/12 20:57:36 (18 months ago)
Author:
mdawaffe
Message:

Publicize

Sync module state when activating/deactivating Publicize so the Jetpack servers know to not publicize posts if the module is deactivated in certain edge cases.

Props justin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/modules/publicize.php

    r622277 r622281  
    3535        $publicize_ui->in_jetpack = $this->in_jetpack; 
    3636 
    37         // if sharedaddy isn't active, the sharing menu hasn't been added yet 
    38         if ( $this->in_jetpack ) { 
     37        // Jetpack specific checks / hooks 
     38        if ( $this->in_jetpack) { 
     39            add_action( 'jetpack_activate_module_publicize',   array( $this, 'module_state_toggle' ) ); 
     40            add_action( 'jetpack_deactivate_module_publicize', array( $this, 'module_state_toggle' ) ); 
     41             
     42            // if sharedaddy isn't active, the sharing menu hasn't been added yet 
    3943            $active = Jetpack::get_active_modules(); 
    4044            if ( in_array( 'publicize', $active ) && !in_array( 'sharedaddy', $active ) ) 
    4145                add_action( 'admin_menu', array( &$publicize_ui, 'sharing_menu' ) ); 
     46        } 
     47    } 
     48 
     49    function module_stats_toggle() { 
     50        // extra check that we are on the JP blog, just incase 
     51        if ( class_exists( 'Jetpack' ) && $this->in_jetpack ) { 
     52            $jetpack = Jetpack::init(); 
     53            $jetpack->sync->register( 'noop' ); 
    4254        } 
    4355    } 
Note: See TracChangeset for help on using the changeset viewer.