Skip to content

Commit

Permalink
Saved the default option if new users select pro features (#993)
Browse files Browse the repository at this point in the history
* Save the default option if new users select pro features

* Fix phpcs error in other files

* Change error notice text
  • Loading branch information
girishpanchal30 authored Jul 12, 2024
1 parent 47b59a3 commit fb30c51
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 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
2 changes: 1 addition & 1 deletion includes/class-rop-i18n.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ public static function get_labels( $key = '' ) {
'revive_network_learn_more_btn' => __( 'Learn More', 'tweet-old-post' ),
'learn_more' => __( 'Learn More!', 'tweet-old-post' ),
'min_interval_6_mins' => __( 'Minimum interval between consecutive shares is 6 minutes.', 'tweet-old-post' ),
'min_interval_between_shares' => __( 'Lowest allowed value for "Minimum Interval Between Shares" is %s hours. Upgrade to Business Plan or higher to fine tune posting times and days.', 'tweet-old-post' ),
'min_interval_between_shares' => __( 'Lowest allowed value for "Minimum Interval Between Shares" is %s hours. Choosing a lower interval is available in the Pro version.', 'tweet-old-post' ),
'min_recurring_schedule_interval' => __( 'Lowest allowed value for "Recurring Schedule Interval" is %d minutes.', 'tweet-old-post' ),
'no_post_types_selected' => __( 'You need to have at least one post type to share.', 'tweet-old-post' ),
'min_number_of_concurrent_posts' => __( 'At least one posts need to be shared.', 'tweet-old-post' ),
Expand Down
1 change: 0 additions & 1 deletion includes/class-rop.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ private function define_admin_hooks() {
$this->loader->add_action( 'admin_notices', $plugin_admin, 'rop_cron_event_status_notice' );
$this->loader->add_action( 'admin_notices', $plugin_admin_notices, 'rop_revive_network_nag_delayed' );


$this->loader->add_action( 'admin_init', $plugin_admin, 'rop_dismiss_linkedin_api_v2_notice' );
$this->loader->add_action( 'admin_notices', $plugin_admin, 'rop_linkedin_api_v2_notice' );
$this->loader->add_action( 'admin_notices', $plugin_admin, 'bitly_shortener_upgrade_notice' );
Expand Down

0 comments on commit fb30c51

Please sign in to comment.