includes/class-freemius.php
private function activate_parent_account( Freemius $parent_fs ) {
            if ( ! $this->is_addon() ) {
                // This is not an add-on.
                return;
            }

            if ( $parent_fs->is_registered() ) {
                // Already activated.
                return;
            }

            // Activate parent with add-on's user credentials.
            $parent_install = $this->get_api_user_scope()->call(
                "/plugins/{$parent_fs->_plugin->id}/installs.json",
                'post',
                $parent_fs->get_install_data_for_api( array(
                    'uid' => $parent_fs->get_anonymous_id(),
                ), false, false )
            );

            if ( isset( $parent_install->error ) ) {
                $this->_admin_notices->add(
                    sprintf( $this->get_text_inline( 'Couldn\'t activate %s.', 'could-not-activate-x' ), $this->get_plugin_name() ) . ' ' .
                    $this->get_text_inline( 'Please contact us with the following message:', 'contact-us-with-error-message' ) . ' ' . '<b>' . $parent_install->error->message . '</b>',
                    $this->get_text_x_inline( 'Oops', 'exclamation', 'oops' ) . '...',
                    'error'
                );

                return;
            }

            $parent_fs->_admin_notices->remove_sticky( 'connect_account' );

            if ( $parent_fs->is_pending_activation() ) {
                $parent_fs->_admin_notices->remove_sticky( 'activation_pending' );

                unset( $parent_fs->_storage->is_pending_activation );
            }

            // Get user information based on parent's plugin.
            $user = $this->get_user();

            // First of all, set site info - otherwise we won't
            // be able to invoke API calls.
            $parent_fs->_site = new FS_Site( $parent_install );
            $parent_fs->_user = $user;

            // Sync add-on plans.
            $parent_fs->_sync_plans();

            $parent_fs->_set_account( $user, $parent_fs->_site );
        }
private function activate_parent_account( Freemius $parent_fs ) {
            if ( ! $this->is_addon() ) {
                // This is not an add-on.
                return;
            }

            if ( $parent_fs->is_registered() ) {
                // Already activated.
                return;
            }

            // Activate parent with add-on's user credentials.
            $parent_install = $this->get_api_user_scope()->call(
                "/plugins/{$parent_fs->_plugin->id}/installs.json",
                'post',
                $parent_fs->get_install_data_for_api( array(
                    'uid' => $parent_fs->get_anonymous_id(),
                ), false, false )
            );

            if ( isset( $parent_install->error ) ) {
                $this->_admin_notices->add(
                    sprintf( $this->get_text_inline( 'Couldn\'t activate %s.', 'could-not-activate-x' ), $this->get_plugin_name() ) . ' ' .
                    $this->get_text_inline( 'Please contact us with the following message:', 'contact-us-with-error-message' ) . ' ' . '<b>' . $parent_install->error->message . '</b>',
                    $this->get_text_x_inline( 'Oops', 'exclamation', 'oops' ) . '...',
                    'error'
                );

                return;
            }

            $parent_fs->_admin_notices->remove_sticky( 'connect_account' );

            if ( $parent_fs->is_pending_activation() ) {
                $parent_fs->_admin_notices->remove_sticky( 'activation_pending' );

                unset( $parent_fs->_storage->is_pending_activation );
            }

            // Get user information based on parent's plugin.
            $user = $this->get_user();

            // First of all, set site info - otherwise we won't
            // be able to invoke API calls.
            $parent_fs->_site = new FS_Site( $parent_install );
            $parent_fs->_user = $user;

            // Sync add-on plans.
            $parent_fs->_sync_plans();

            $parent_fs->_set_account( $user, $parent_fs->_site );
        }
private function activate_parent_account ( Freemius $ parent_fs ) { if ( ! $ this -> is_addon ( ) ) { // This is not an add-on.
 return ; } if ( $ parent_fs -> is_registered ( ) ) { // Already activated.
 return ; } // Activate parent with add-on's user credentials.
 $ parent_install = $ this -> get_api_user_scope ( ) -> call ( "/plugins/{$parent_fs->_plugin->id}/installs.json" , 'post' , $ parent_fs -> get_install_data_for_api ( array ( 'uid' => $ parent_fs -> get_anonymous_id ( ) , ) , false , false ) ) ; if ( isset ( $ parent_install -> error ) ) { $ this -> _admin_notices -> add ( sprintf ( $ this -> get_text_inline ( 'Couldn\'t activate %s.' , 'could-not-activate-x' ) , $ this -> get_plugin_name ( ) ) . ' ' . $ this -> get_text_inline ( 'Please contact us with the following message:' , 'contact-us-with-error-message' ) . ' ' . '<b>' . $ parent_install -> error -> message . '</b>' , $ this -> get_text_x_inline ( 'Oops' , 'exclamation' , 'oops' ) . '...' , 'error' ) ; return ; } $ parent_fs -> _admin_notices -> remove_sticky ( 'connect_account' ) ; if ( $ parent_fs -> is_pending_activation ( ) ) { $ parent_fs -> _admin_notices -> remove_sticky ( 'activation_pending' ) ; unset ( $ parent_fs -> _storage -> is_pending_activation ) ; } // Get user information based on parent's plugin.
 $ user = $ this -> get_user ( ) ; // First of all, set site info - otherwise we won't
 // be able to invoke API calls.
 $ parent_fs -> _site = new FS_Site ( $ parent_install ) ; $ parent_fs -> _user = $ user ; // Sync add-on plans.
 $ parent_fs -> _sync_plans ( ) ; $ parent_fs -> _set_account ( $ user , $ parent_fs -> _site ) ; }
Tries to activate parent account based on add-on's info.

@author Vova Feldman (@svovaf)
@since  1.2.2.7

@param Freemius $parent_fs
Tries to activate parent account based on add - on s info .