I'm kind of new to Drupal so please bear with me. My question is, is it possible to replace the teaser/content for anonymous users? I have some restricted content but I don't want it to be removed and hidden from anon users, just show something that says they should be logged in to view the content/teaser. I've searched for hours and everything that comes up hides the content completely. I've seen a module that kind of does this thing (restricted content module) but it's only available on d6. I'm using d7.

Thanks in advance!

  • I'd think you'd be able to do this with the Views module. You can create a view that displays teasers, but you can set the permissions on that view, though what permissions you have available I'm not quite sure of, I'd think something like "user must be logged in" would be available. Commented Oct 12, 2012 at 16:36
  • Hi, thanks for the reply. I think I've tried that method and it removes the teaser/content completely. What I would like to happen is that the teaser/content is there but it is displaying a note that it is blocked. This way, users know that they are missing something and that they must register to view it.
    – gamebug
    Commented Oct 12, 2012 at 16:51
  • Yeah I think there's also a part of configuring a view that displays an alternate message if the view could not be, erm, well, viewed. Commented Oct 12, 2012 at 17:04
  • Yeah, under Advanced for configuring the view, you want to investigate the "No results behavior" section. Commented Oct 12, 2012 at 17:05
  • Thanks but I think you're referring to the "no results behavior". I think that only applies if there is really nothing to display. (or am I missing something?)
    – gamebug
    Commented Oct 12, 2012 at 17:35

2 Answers 2


For displaying different teaser for anonymous user, you can create a custom tpl for that node type and put your message in it.

global $user;
if ($user->uid) {

  //Default code for node teaser/content 

} else {
  echo "Your custom message";

Make sure you place your tpl in theme folder.

  • Hi, I'm sorry but I'm really new to Drupal (and coding). Can you be specific where and what file should I put it? Thanks
    – gamebug
    Commented Oct 15, 2012 at 2:47
  • You need to create a tpl file in the themes folder. If you are using custom/contributed theme then its under (site root)/sites/all/themes/YOUR_THEME_NAME. Create copy of node.tpl.php and rename it as node--YOUR_NODE_TYPE.tpl.php. In this file you will find the teaser rendering code. This is the place where you put condition suggested by me.
    – bmhaskar
    Commented Oct 15, 2012 at 17:54

You can separate teaser from body as a new field, and use module "Field permissions" or similar modules.You can control access for that field.

Another way is custom module which use hook_node_view or hook_node_grants_alter to control if user can access node.

  • Thanks for the help. How can I create teaser as a new field? Also is it possible to restrict access based on taxonomy term (i.e. I tagged them premium which makes premium + logged in as filters)?
    – gamebug
    Commented Oct 14, 2012 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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