wolfhesse
11/15/2017 - 2:46 AM

survey message / ignore code snippets message via get_user_meta( $current_user-> ID, $key )

survey message / ignore code snippets message via get_user_meta( $current_user-> ID, $key )

function survey_message() {
		global $current_user;

		$key = 'ignore_code_snippets_survey_message';

		/* Bail now if the user has dismissed the message */
		if ( get_user_meta( $current_user->ID, $key ) ) {
			return;
		} elseif ( isset( $_GET[ $key ], $_REQUEST['_wpnonce'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'], $key ) ) {
			add_user_meta( $current_user->ID, $key, true, true );

			return;
		}

		?>

		<br/>

		<div class="updated"><p>

				<?php _e( "<strong>Have feedback on Code Snippets?</strong> Please take the time to answer a short survey on how you use this plugin and what you'd like to see changed or added in the future.", 'code-snippets' ); ?>

				<a href="http://sheabunge.polldaddy.com/s/code-snippets-feedback" class="button secondary"
				   target="_blank" style="margin: auto .5em;">
					<?php _e( 'Take the survey now', 'code-snippets' ); ?>
				</a>

				<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( $key, true ), $key ) ); ?>"><?php esc_html_e( 'Dismiss', 'code-snippets' ); ?></a>

			</p></div>