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?

  • i put it just at the end of the file, not under any specific function. – user9881 Sep 10 '12 at 15:35
  • Under which function i am supposed to put this? – user9881 Sep 11 '12 at 6:19
  • possible duplicate of Display flag to anonymous user – gagarine Sep 7 '14 at 10:57

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


Why not just use the Session API module.

The Session API is a very simple set of functions that extend the core sessions workings, allowing data to be stored and associated with a user's session.

There is no need to install this module unless you are instructed to do so by another module.

Currently this module is used by

Flag DrupalChat Mozilla Persona Session Favorites Domain User Default The Sign-Up Problem

  • Because the session API module is essentially abandoned (last release was in 2012, and is not stable - see RC1 in the name.) It currently breaks the page cache, and if you are using a reverse-proxy cache it will not work. See drupal.org/node/1983696 – jenlampton Apr 11 '15 at 3:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.