using PHP Views I want to set the filter to look in another field and if it contains the current user's username then show the row. I have the value for the field to match as $organiser and I believe the value for the user is global $user but I am not sure if that is the id or the name. So the condition is:

if $organiser contains $user then show row.

but I am not familiar with the conventions in php coding; could any one help me here? I am aware that php views is a form of hacking but it is such a small thing that I want. Info on the module is here
https://www.drupal.org/node/1686948

Comments

Jaypan’s picture

$user is the full user object - all the user information. If you want the UID it's $user->uid, and if you want their username it's $user->name.

mattyboy57’s picture

thanks for that.

now all I need to work out is how to return the $user->name into the column "current user" of each row in the table. Then I can do the comparison easily :-)