romandor
romandor

Reputation: 21

Howto: Block visible only if node X is published?

With this code I show node in block:

print check_markup(node_load(777, NULL, TRUE) -> body);

Problem: block displayed even node 777 is unpublished. Thank you in advance!

Upvotes: 1

Views: 296

Answers (1)

Nikit
Nikit

Reputation: 5128

$node = node_load(777);
if ($node->status) {
  print $node->body...
}

Upvotes: 2

Related Questions