By ekendra on
This should be an easy one for someone familiar. I've been at it for a few hours now and searching the forums to no avail.
All i want to do is to show a block only when comments are enabled on a particular node.
I've already tried using the 'Show if the following PHP code returns TRUE (PHP-mode, experts only).' feature but I don't exactly know which variable to test for.
I tried this already, but it only tests to see if a comment has been made, not if they are enabled and even that doesn't quite work correctly:
<?php
if ($node->comment != 0) {
return TRUE;
} else {
return FALSE;
}
?>
any ideas?
Comments
Couldn't completely sort it
Couldn't completely sort it but if you do a var_dump of $node->links you'll see it changes depending on if comments are allowed or not. You should be able to cook something up from that.
Good luck
Neil
--
Drupal Development for Pleasure and Profit
http://drupal.altate.ch
--
Neil Cameron
Interesting. var_dump
Interesting.
var_dump ($node->links);brings up NULL. huh? This is from the block code itself. Can't understand that. any clues?
After some trial and error I've determined that the $node variable isn't available for the block function or for the TRUE/FALSE test.
How else am I supposed to test whether or not comments are enabled? Freaky.
anyone?
anyone?
I tried summoning $node as a global and then performing the TRUE/FALSE test but nothing.
Didn't expect this one to be
Didn't expect this one to be ignored by the purportedly 'active' Drupal community.
All I want to do is to show a block on nodes only when comments are enabled on that node.
Surely there is a solution?
Finally hacked something out
Finally hacked something out that worked.
Go-run-gaa-!!