tools = $tools; } /** * Add action & filter hooks. */ public function add_hooks() { add_action( 'admin_notices', array( $this, 'show' ) ); add_action( 'mc4wp_admin_dismiss_review_notice', array( $this, 'dismiss' ) ); } /** * Set flag in user meta so notice won't be shown. */ public function dismiss() { $user = wp_get_current_user(); update_user_meta( $user->ID, $this->meta_key_dismissed, 1 ); } /** * @return bool */ public function show() { // only show on Mailchimp for WordPress' pages. if ( ! $this->tools->on_plugin_page() ) { return false; } // only show if 2 weeks have passed since first use. $two_weeks_in_seconds = ( 60 * 60 * 24 * 14 ); if ( $this->time_since_first_use() <= $two_weeks_in_seconds ) { return false; } // only show if user did not dismiss before $user = wp_get_current_user(); if ( get_user_meta( $user->ID, $this->meta_key_dismissed, true ) ) { return false; } echo '
';
echo esc_html__( 'You\'ve been using Mailchimp for WordPress for some time now; we hope you love it!', 'mailchimp-for-wp' ), '
';
echo sprintf( wp_kses( __( 'If you do, please leave us a 5★ rating on WordPress.org. It would be of great help to us.', 'mailchimp-for-wp' ), array( 'a' => array( 'href' => array() ) ) ), 'https://wordpress.org/support/view/plugin-reviews/mailchimp-for-wp?rate=5#new-post' );
echo '