I’m making a web-based treasure hunt using WordPress password protected posts for each clue. (You enter the answer to the previous puzzle as the password to view the next one.) If some people share a computer, I want the site to ask them for the password each time they visit each post (or even hit “refresh”) so there’ll be no skipping ahead.
Right now, there is a cookie that gets created when the correct password is entered. Then, if someone comes back to the password protected post later, they don’t have to input the password again.
Here’s what I want to happen:
1) visit post the first time, it says, “Enter password to view content” or whatever.
2) you enter the password
3) the page refreshes showing the content of the post
—– all of the above happens right now —-
4) the cookie is deleted
5) if the user pushes Refresh or navigates away and comes back they see the message “Enter password to view content.”
I was thinking that by just putting some sort of delete cookie function in the footer of my theme, it could load the page contents and then delete the cookie as soon as it’s loaded.
Would that work? How would I do it?
Any help anyone can offer would be greatly appreciated.