Hi,

I want to display a certain block only if the user viewing a node is:

1. The author of the current node

2. The author of one of the comments in a node.

Is there any method to do this? Via php code? etc?

Thanks in Advance
DIMSKK

Comments

msypes’s picture

Yes. This is do-able:
In the block configuration page is an option to show the block dependent on php code.
You can have the block reference the global $user and the global $node variables.
If the user ID matches the node author's ID, return true.
(I haven't used Drupal in a while, just getting back into it w/ 7, so I can't give you precise code.)

Michael

DIMSKK’s picture

Hi,

Thanks for your reply. Well, I think I had sorted out the problem of block visibility according to the node's author. But the problem was: I also needed it for all the comment authors of the node.

Any ideas about referencing the comments' authors??

DIMSKK

msypes’s picture

Again, I haven't used D6 in a while, but you should be able to get the comment authors from the node object as well.
I started off thinking the cid's would be be referenced within the node object. You can print_r($node) and look. If so, you're golden. If not, check out this page: http://api.drupal.org/api/drupal/modules--comment--comment.module/functi...
You may need to use use this function or write something similar to pull out the comment authors' id's and again match them against the global $user.

Michael