$time, 'dismissed' => false, ); update_option( 'adfoin_review', $review ); } else { // Check if it has been dismissed or not. if ( ( isset( $review['dismissed'] ) && ! $review['dismissed'] ) && ( isset( $review['time'] ) && ( ( $review['time'] + DAY_IN_SECONDS ) <= $time ) ) ) { $load = true; } } // If we cannot load, return early. if ( ! $load ) { return; } $oldest_active = $wpdb->get_row( "SELECT *, DATE_FORMAT(time, '%m/%d/%Y') FROM {$wpdb->prefix}adfoin_integration WHERE status = 1 AND DATE(time) < CURDATE() - INTERVAL 30 DAY ORDER BY ID DESC", ARRAY_A ); if ( $oldest_active ) { $this->review(); } } /** * Show review request. * * @since 1.35.0 */ public function review() { // Review html ?>
CSRF-able too). if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( null, 403 ); } check_ajax_referer( 'adfoin_review_dismiss', '_nonce' ); $review = get_option( 'adfoin_review', array() ); $review['time'] = time(); $review['dismissed'] = true; update_option( 'adfoin_review', $review ); wp_send_json_success(); } /** * Display footer text * * @since 1.35.0 * * @param string $text * * @return string */ public function admin_footer( $text ) { global $current_screen; if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'advanced-form-integration' ) !== false ) { $url = 'https://wordpress.org/support/plugin/advanced-form-integration/reviews/?filter=5#new-post'; $text = sprintf( wp_kses( /* translators: $1$s - WPForms plugin name; $2$s - WP.org review link; $3$s - WP.org review link. */ __( 'Thank you for using %1$s. Please rate us ★★★★★ on WordPress.org to boost our motivation.', 'advanced-form-integration' ), array( 'a' => array( 'href' => array(), 'target' => array(), 'rel' => array(), ), ) ), 'Advanced Form Integration', $url, $url ); } return $text; } } new Advanced_Form_Integration_Review;