I have a survey inside a modal. The intent is to display this to logged in users only. That part works fine. The issue is how to prevent it from displaying again once they have submitted it. I'm guessing there are hooks or methods in WP which would make this easy although I am unsure what they would be. Any possible solution would help.
The 2 approaches that first come to mind are a boolean value attached to each user. For example formCompleted = false, then have the posted survey set it to false. The next idea would just be some type of cookie detection?
You can add a user meta when he completes the survey:
if( user_completed_survey() )
add_user_meta( get_current_user_id(), 'survey-done', 1);
And check it everytime:
if(is_user_logged_in() && !get_user_meta( get_current_user_id(), 'survey-done', true )) {
// show survey
}