From e27a29e37031e962f618e8cd15a9c716331d8370 Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Tue, 9 Jul 2024 11:08:50 +0530 Subject: [PATCH] Set new option for new users --- includes/admin/class-rop-admin.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/includes/admin/class-rop-admin.php b/includes/admin/class-rop-admin.php index f329badb7..8ca2d608a 100644 --- a/includes/admin/class-rop-admin.php +++ b/includes/admin/class-rop-admin.php @@ -389,8 +389,16 @@ public function enqueue_scripts() { $rop_api_settings['tracking'] = 'yes' === get_option( 'tweet_old_post_logger_flag', 'no' ); $rop_api_settings['tracking_info_link'] = sanitize_url( 'https://docs.revive.social/article/2008-revive-old-posts-usage-tracking' ); - $last_post_shared = get_option( 'rop_last_post_shared', '' ); - $rop_api_settings['is_new_user'] = empty( $last_post_shared ); + + $is_new_user = (int) get_option( 'rop_is_new_user', 0 ); + $install_time = ! $is_new_user ? (int) get_option( 'rop_first_install_date', 0 ) : 0; + $install_time = strtotime( '-1 hour' ); + + if ( ! $is_new_user && ( $install_time && $install_time >= strtotime( '-1 hour' ) ) ) { + $is_new_user = update_option( 'rop_is_new_user', 1 ); + } + + $rop_api_settings['is_new_user'] = $is_new_user; wp_localize_script( $this->plugin_name . '-' . $page, 'ropApiSettings', $rop_api_settings ); wp_localize_script( $this->plugin_name . '-' . $page, 'ROP_ASSETS_URL', array( ROP_LITE_URL . 'assets/' ) );