Skip to content

Commit

Permalink
Save the default option if new users select pro features
Browse files Browse the repository at this point in the history
  • Loading branch information
girishpanchal30 committed Jul 11, 2024
1 parent f3925a7 commit 00b4192
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions includes/admin/class-rop-rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] );
Expand Down

0 comments on commit 00b4192

Please sign in to comment.