# ultimate-post/2.1.3/classes/Compatibility.php

Post Grid Gutenberg Blocks – PostX, version 2.1.3. 35 lines.

- Page: https://pluginprobe.com/plugins/ultimate-post/2.1.3/code/classes/Compatibility.php
- Raw: https://pluginprobe.com/plugins/ultimate-post/2.1.3/raw/classes/Compatibility.php
- Modified: 2020-12-06T01:52:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ultimate-post/2.1.3/code/classes/Compatibility.php#L10-L20`.

```php
<?php
namespace ULTP;

defined('ABSPATH') || exit;

class Compatibility{

    public function __construct(){
        add_action( 'upgrader_process_complete', array($this, 'plugin_upgrade_completed'), 10, 2 );
    }

    public function plugin_upgrade_completed( $upgrader_object, $options ) {
        if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ){
            foreach( $options['plugins'] as $plugin ) {
                if( $plugin == ULTP_BASE ) {
                    $set_settings = array(
                        'ultp_templates' => 'true',
                        'ultp_elementor' => 'true',
                    );
                    
                    // Pro Addons Data Init
                    $addon_data = get_option('ultp_addons_option', array());
                    if (isset($addon_data['ultp_category'])) {
                        $set_settings['ultp_category'] = $addon_data['ultp_category'];
                    }

                    foreach ($set_settings as $key => $value) {
                        ultimate_post()->set_setting($key, $value);
                    }
                }
            }
        }
    }

}
```
