Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the Basic theme, and I get the following error when I refresh my site.

Notice: Undefined variable: unpublished in include() (line 18 of /Users/me/Projects/mysite/httdocs/sites/all/themes/mytheme/templates/node.tpl.php).

The line that is caused the notice is the following one.

    <?php if ($unpublished): ?>
      <p class="unpublished"><?php print t('Unpublished'); ?></p>
    <?php endif; ?>
<?php endif; ?>

I don't understand this error. How can I fix it?

share|improve this question
This is a bug drupal.org/node/1778676 – Mike Apr 23 '13 at 13:42
up vote 5 down vote accepted

Try if ($node->status == 0) instead of if ($unpublished).

This may be happening because the variable is not set correctly in a hook_preprocess_node() implementation of the theme; you may also want to check the template.php file in your theme for these hooks.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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