get_option( 'rtsb_plugin_activation_time', false ); // Bail until the activation time is recorded, otherwise the notice would show immediately. if ( ! $install_date ) { return; } $now = strtotime( 'now' ); $remind_time = get_option( 'rtsb_admin_review_remind_me' ); if ( $remind_time ) { // User asked to be reminded later: show again 20 days after that click. if ( $now < strtotime( '+20 days', $remind_time ) ) { return; } } elseif ( $now < strtotime( '+15 days', $install_date ) ) { // First time: show 15 days after installation. return; } add_action( 'admin_notices', [ $this, 'display_admin_notice' ] ); } /** * Remove the notice for the user if review already done or if the user does not want to * * @return void */ public function notice_actions() { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'rtsb_notice_nonce' ) ) { return; } if ( ! empty( $_GET['rtsb_admin_review_spare_me'] ) ) { $spare_me = absint( $_GET['rtsb_admin_review_spare_me'] ); if ( 1 == $spare_me ) { update_option( 'rtsb_admin_review_spare_me', '1' ); } } if ( ! empty( $_GET['rtsb_admin_review_remind_me'] ) ) { $remind_me = absint( $_GET['rtsb_admin_review_remind_me'] ); if ( 1 == $remind_me ) { $get_activation_time = strtotime( 'now' ); update_option( 'rtsb_admin_review_remind_me', $get_activation_time ); } } if ( ! empty( $_GET['rtsb_admin_review_rated'] ) ) { $rtsb_admin_review_rated = absint( $_GET['rtsb_admin_review_rated'] ); if ( 1 == $rtsb_admin_review_rated ) { update_option( 'rtsb_admin_review_rated', 'yes' ); } } } /** * @return false|string */ protected function rtsb_current_admin_url() { $uri = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; $uri = preg_replace( '|^.*/wp-admin/|i', '', $uri ); if ( ! $uri ) { return ''; } return remove_query_arg( [ '_wpnonce', '_wc_notice_nonce', 'wc_db_update', 'wc_db_update_nonce', 'wc-hide-notice', 'rtsb_admin_review_spare_me', 'rtsb_admin_review_remind_me', 'rtsb_admin_review_rated', ], admin_url( $uri ) ); } /** * Display Admin Notice, asking for a review **/ public function display_admin_notice() { if ( isset( $GLOBALS['woobundle_notice'] ) || isset( $GLOBALS['rtsb__notice'] ) ) { return; } global $pagenow; $exclude = [ 'themes.php', 'users.php', 'tools.php', 'options-general.php', 'options-writing.php', 'options-reading.php', 'options-discussion.php', 'options-media.php', 'options-permalink.php', 'options-privacy.php', 'admin.php', 'import.php', 'export.php', 'site-health.php', 'export-personal-data.php', 'erase-personal-data.php', ]; if ( ! in_array( $pagenow, $exclude, true ) ) { $args = [ '_wpnonce' => wp_create_nonce( 'rtsb_notice_nonce' ) ]; $dont_disturb = add_query_arg( $args + [ 'rtsb_admin_review_spare_me' => '1' ], $this->rtsb_current_admin_url() ); $remind_me = add_query_arg( $args + [ 'rtsb_admin_review_remind_me' => '1' ], $this->rtsb_current_admin_url() ); $rated = add_query_arg( $args + [ 'rtsb_admin_review_rated' => '1' ], $this->rtsb_current_admin_url() ); $reviewurl = 'https://wordpress.org/support/plugin/shopbuilder/reviews/#new-post'; $plugin_name = 'ShopBuilder – Elementor WooCommerce Builder Addons'; ?>

Enjoying ?

Thank you for choosing ShopBuilder. If you have found our plugin useful and makes you smile, please consider giving us a 5-star rating on WordPress.org. It will help us to grow.