From 00b419220ca826cf9ec57589826023ff9a6a68a4 Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Thu, 11 Jul 2024 16:10:33 +0530 Subject: [PATCH] Save the default option if new users select pro features --- includes/admin/class-rop-rest-api.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/includes/admin/class-rop-rest-api.php b/includes/admin/class-rop-rest-api.php index ac029df79..aff8f8f68 100644 --- a/includes/admin/class-rop-rest-api.php +++ b/includes/admin/class-rop-rest-api.php @@ -365,6 +365,21 @@ private function save_post_format( $data ) { } } + // New users will require a pro plan. + $global_settings = new Rop_Global_Settings(); + $is_new_user = (int) get_option( 'rop_is_new_user', 0 ); + if ( $global_settings->license_type() <= 0 && $is_new_user ) { + if ( 'custom_field' === $data['data']['post_content'] ) { + $data['data']['post_content'] = 'post_title'; + } + if ( ! in_array( $data['data']['hashtags'], array( 'no-hashtags', 'common-hashtags' ), true ) ) { + $data['data']['hashtags'] = 'no-hashtags'; + } + if ( ! in_array( $data['data']['short_url_service'], array( 'rviv.ly', 'wp_short_url' ), true ) ) { + $data['data']['short_url_service'] = 'rviv.ly'; + } + } + try { if ( $data['data']['short_url_service'] !== 'wp_short_url' ) { $shortner = $sh_factory->build( $data['data']['short_url_service'] );