How to display flags to anonymous users and redirect to login after clicking a flag? I want to display flag to anonymous user and upon clicking the user should be redirected to register/login page.

I found one answer to this problem in the question about 
"How to display a flag to anonymous users?".

I tried this solution but did not work, may be I did not put the code in correct place?

I am using Bartik as my template and I put the code in node.tpl.php.

Any suggestions?
Maybe the Flag anonymous module is what are you looking for.