Remember, the threads are static HTML files. You can't affect the contents at any other point than when somebody is posting.
What you could do is always add buttons, and use CSS to hide them and some Javascript to check for cookies and un-hide the buttons as needed.