Sign up ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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 – Mike Apr 23 '13 at 13:42

1 Answer 1

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.