latest version

Integrate Ultimate GDPR with Plugin

These are some of the hooks to declare for collecting data and compatibility.

Note

PLUGIN_NAME is the name of your plugin as in ‘active_plugins’ wordpress option.

ct_ultimate_gdpr_controller_plugins_compatible_PLUGIN_NAME

This is used to declare whether or not the plugin is compatible with Ultimate GDPR. The result will be shown in Ultimate GDPR > Plugins.
../_images/sample.png

Example: Woocommerce Ultimate Discount plugin:

ct-woocommerce-ultimate-discount/ctUltimateDiscount.php

Declare Compatible

add_filter( "ct_ultimate_gdpr_controller_plugins_compatible_ct-woocommerce-ultimate-discount/ctUltimateDiscount.php", '__return_true' );

Declare Not Compatible

add_filter( "ct_ultimate_gdpr_controller_plugins_compatible_ct-woocommerce-ultimate-discount/ctUltimateDiscount.php", '__return_false' );

Declare Partly Compatible

add_filter( "ct_ultimate_gdpr_controller_plugins_compatible_ct-woocommerce-ultimate-discount/ctUltimateDiscount.php", is_compatible );
function is_compatible() {
return CT_Ultimate_GDPR_Controller_Plugins::PLUGIN_COMPATIBLE_PARTLY;
}

ct_ultimate_gdpr_controller_plugins_collects_data_PLUGIN_NAME

This is used to declare whether or not the plugin collects any user data. The result will be shown in Ultimate GDPR > Plugins.
../_images/sample1.png

Example: Woocommerce Ultimate Discount plugin:

ct-woocommerce-ultimate-discount/ctUltimateDiscount.php

Declare to collect

add_filter( "ct_ultimate_gdpr_controller_plugins_collects_data_ct-woocommerce-ultimate-discount/ctUltimateDiscount.php", '__return_true' );

Declare to not collect

add_filter( "ct_ultimate_gdpr_controller_plugins_collects_data_ct-woocommerce-ultimate-discount/ctUltimateDiscount.php", '__return_false' );


Extend Functionality of Ultimate GDPR for Plugin

You may extend functionality of Ultimate GDPR by implementing services features for your plugin:

  1. Extend php class CT_Ultimate_GDPR_Service_Abstract or implement the CT_Ultimate_GDPR_Service_Interface interface

    Example:

    class CT_Ultimate_GDPR_Service_Contact_Form_7 extends
    CT_Ultimate_GDPR_Service_Abstract {
    }
    
  2. Implement required methods (some actions can be left empty)

  3. Add an object of your service to the array of services to be registered in Ultimate GDPR:

    apply_filters( 'ct_ultimate_gdpr_load_services', array(), $options, $this->services );
    

    or, if you extended CT_Ultimate_GDPR_Service_Abstract, it will autoregister when instantiated.

  4. To add options to admin, utilize WordPress Options API function ‘add_settings_field’ on ‘current_screen’ hook. This is hook automatically in abstract class by the ‘add_option_fields’ function.


Adding New Controller to the Plugin

There is also a possibility of adding new controller (and therefore new menu page) to the plugin:

  1. Either extend php class CT_Ultimate_GDPR_Controller_Abstract or implement the CT_Ultimate_GDPR_Controller_Interface intefrace

    Example:

    class CT_Ultimate_GDPR_Controller_Forgotten extends
    CT_Ultimate_GDPR_Controller_Abstract {
    }
    
  2. Implement required methods (some actions can be left empty)

  3. Add an object of your controller to the array of controllers to be registered in Ultimate GDPR:

    apply_filters( 'ct_ultimate_gdpr_controllers', array() );
    
  4. To add a menu page, you can utilize ‘add_menu_page’ function if you extended the abstract class.

  5. To add options to admin, please utilize WordPress Options API function ‘add_settings_field’