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
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
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' );
If you are the creator of the super-awesome-plugin and would like to declare that your plugin:
is compatible
is collecting user data
Step 1 - get plugin main file
First, verify plugin main file. You can find this information in the wp_options table under the option_name active_plugins. Alternatively, you can use the WP CLI command to display this information:
wp option get active_plugins
You will see an output similar to this:
array ( 0 => 'menu-image/menu-image.php', 1 => 'classic-editor/classic-editor.php', 2 => 'contact-form-7/wp-contact-form-7.php', 3 => 'ct-ultimate-gdpr/ct-ultimate-gdpr.php', 4 => 'easy-wp-smtp/easy-wp-smtp.php', 5 => 'intuitive-custom-post-order/intuitive-custom-post-order.php', 6 => 'super-awesome-plugins/super.php', 7 => 'tawkto-live-chat/tawkto.php', )
We are seeing that filter name needs to include super-awesome-plugins/super.php.
Step 2 - add plugin hooks
Next, add these hooks to your plugin’s source code to declare compatibility and data collection:
add_filter( "ct_ultimate_gdpr_controller_plugins_compatible_super-awesome-plugins/super.php", '__return_true' ); add_filter( "ct_ultimate_gdpr_controller_plugins_collects_data_super-awesome-plugins/super.php", '__return_true' );
Note
Results:
You may extend functionality of Ultimate GDPR & CCPA by implementing services features for your plugin:
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 { }Implement required methods (some actions can be left empty)
Add an object of your service to the array of services to be registered in Ultimate GDPR & CCPA:
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.
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.
There is also a possibility of adding new controller (and therefore new menu page) to the plugin:
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 { }Implement required methods (some actions can be left empty)
Add an object of your controller to the array of controllers to be registered in Ultimate GDPR & CCPA:
apply_filters( 'ct_ultimate_gdpr_controllers', array() );To add a menu page, you can utilize ‘add_menu_page’ function if you extended the abstract class.
To add options to admin, please utilize WordPress Options API function ‘add_settings_field’