tags:

views:

50

answers:

1

I would like to show / hide certain fields in my Drupal view based on whether the current user is the author of the node being viewed.

I installed the Views Custom Field module which seems to allow this, but I have no knowledge of PHP, so wondered if anyone could help me with the PHP code.

A: 

Something like this (check that $data has uid, maybe different name):

global $user;
if ($user->uid == $data->uid) {
  print 'something';
}
Nikit
thanks that is very helpful. Another questoin if you don't mind.
Ankh2054
How do I find out the name of the field I want to print ?
Ankh2054
print_r($data); and you will see in view result some internal of $data
Nikit

related questions