How to null WPDiscuz addons

To null all wpDiscuz addons and not have to edit their files or even enter license keys, just paste the code below into the theme functions.php page and any WPDiscuz addons installed will automatically be activated.

Another way to put these lines of codes without touching the source file is using Code Snippets plugin.

function fix_wpdiscuz_addons() {
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
$all_plugins = get_plugins();
$slugs = [];
foreach ( $all_plugins as $plugin_slug=>$values ){
if(strpos ($plugin_slug, "pdiscuz-")){
$slug_parts = explode("/", $plugin_slug);
$slugs[] = $slug_parts[0];
foreach($slugs as $discuz_addon){
if(!get_option('gvt_product_secret_' . $discuz_addon)){
add_option('gvt_product_secret_' . $discuz_addon, 'Congratulations! Plugin activated successfully.');
add_action( 'admin_init', 'fix_wpdiscuz_addons' );