Created
November 15, 2017 02:46
-
-
Save wolfhesse/4cbb4e49d2114a6ce2c5dbeed4ef0320 to your computer and use it in GitHub Desktop.
survey message / ignore code snippets message via get_user_meta( $current_user-> ID, $key )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment