includes/class-freemius.php
function delete_network_account_event( $check_user = true ) {
            $this->_logger->entrance( 'slug = ' . $this->_slug );

            if ( $check_user && ! $this->is_user_admin() ) {
                return;
            }

            $this->do_action( 'before_network_account_delete' );

            // Clear all admin notices.
            $this->_admin_notices->clear_all_sticky();

            $this->_delete_plans( false, false );

            $this->_delete_licenses( false );

            // Delete add-ons related to plugin's account.
            $this->_delete_account_addons( false );

            // @todo Delete plans and licenses of add-ons.

            self::$_accounts->store( true );

            /**
             * IMPORTANT:
             *  Clear crons must be executed before clearing all storage.
             *  Otherwise, the cron will not be cleared.
             */
            $this->clear_sync_cron( true );
            $this->clear_install_sync_cron( true );

            $sites = self::get_sites();

            $install_ids = array();
            foreach ( $sites as $site ) {
                $blog_id = self::get_site_blog_id( $site );

                $install_id = $this->_delete_site( true, $blog_id );

                // Clear all storage data.
                $this->_storage->clear_all( true, array( 'connectivity_test' ), $blog_id );

                if ( FS_Site::is_valid_id( $install_id ) ) {
                    $install_ids[] = $install_id;
                }

                switch_to_blog( $blog_id );

                $this->do_action( 'after_account_delete' );

                restore_current_blog();
            }

            $this->_storage->clear_all( true, array(
                'connectivity_test',
                'is_on',
            ), true );

            // Send delete event.
            if ( ! empty( $install_ids ) ) {
                $result = $this->get_current_or_network_user_api_scope()->call( "/plugins/{$this->_module_id}/installs.json?ids=" . implode( ',', $install_ids ), 'delete' );
            }

            $this->do_action( 'after_network_account_delete' );
        }
function delete_network_account_event( $check_user = true ) {
            $this->_logger->entrance( 'slug = ' . $this->_slug );

            if ( $check_user && ! $this->is_user_admin() ) {
                return;
            }

            $this->do_action( 'before_network_account_delete' );

            // Clear all admin notices.
            $this->_admin_notices->clear_all_sticky();

            $this->_delete_plans( false, false );

            $this->_delete_licenses( false );

            // Delete add-ons related to plugin's account.
            $this->_delete_account_addons( false );

            // @todo Delete plans and licenses of add-ons.

            self::$_accounts->store( true );

            /**
             * IMPORTANT:
             *  Clear crons must be executed before clearing all storage.
             *  Otherwise, the cron will not be cleared.
             */
            $this->clear_sync_cron( true );
            $this->clear_install_sync_cron( true );

            $sites = self::get_sites();

            $install_ids = array();
            foreach ( $sites as $site ) {
                $blog_id = self::get_site_blog_id( $site );

                $install_id = $this->_delete_site( true, $blog_id );

                // Clear all storage data.
                $this->_storage->clear_all( true, array( 'connectivity_test' ), $blog_id );

                if ( FS_Site::is_valid_id( $install_id ) ) {
                    $install_ids[] = $install_id;
                }

                switch_to_blog( $blog_id );

                $this->do_action( 'after_account_delete' );

                restore_current_blog();
            }

            $this->_storage->clear_all( true, array(
                'connectivity_test',
                'is_on',
            ), true );

            // Send delete event.
            if ( ! empty( $install_ids ) ) {
                $result = $this->get_current_or_network_user_api_scope()->call( "/plugins/{$this->_module_id}/installs.json?ids=" . implode( ',', $install_ids ), 'delete' );
            }

            $this->do_action( 'after_network_account_delete' );
        }
function delete_network_account_event ( $ check_user = true ) { $ this -> _logger -> entrance ( 'slug = ' . $ this -> _slug ) ; if ( $ check_user && ! $ this -> is_user_admin ( ) ) { return ; } $ this -> do_action ( 'before_network_account_delete' ) ; // Clear all admin notices.
 $ this -> _admin_notices -> clear_all_sticky ( ) ; $ this -> _delete_plans ( false , false ) ; $ this -> _delete_licenses ( false ) ; // Delete add-ons related to plugin's account.
 $ this -> _delete_account_addons ( false ) ; // @todo Delete plans and licenses of add-ons.
 self :: $ _accounts -> store ( true ) ; /**
             * IMPORTANT:
             *  Clear crons must be executed before clearing all storage.
             *  Otherwise, the cron will not be cleared.
             */ $ this -> clear_sync_cron ( true ) ; $ this -> clear_install_sync_cron ( true ) ; $ sites = self :: get_sites ( ) ; $ install_ids = array ( ) ; foreach ( $ sites as $ site ) { $ blog_id = self :: get_site_blog_id ( $ site ) ; $ install_id = $ this -> _delete_site ( true , $ blog_id ) ; // Clear all storage data.
 $ this -> _storage -> clear_all ( true , array ( 'connectivity_test' ) , $ blog_id ) ; if ( FS_Site :: is_valid_id ( $ install_id ) ) { $ install_ids [ ] = $ install_id ; } switch_to_blog ( $ blog_id ) ; $ this -> do_action ( 'after_account_delete' ) ; restore_current_blog ( ) ; } $ this -> _storage -> clear_all ( true , array ( 'connectivity_test' , 'is_on' , ) , true ) ; // Send delete event.
 if ( ! empty ( $ install_ids ) ) { $ result = $ this -> get_current_or_network_user_api_scope ( ) -> call ( "/plugins/{$this->_module_id}/installs.json?ids=" . implode ( ',' , $ install_ids ) , 'delete' ) ; } $ this -> do_action ( 'after_network_account_delete' ) ; }
Delete network level account.

@author Vova Feldman (@svovaf)
@since  2.0.0

@param bool $check_user Enforce checking if user have plugins activation privileges.
Delete network level account .