Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By mattyboy57 on
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
$user is the full user object
$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.
thanks
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 :-)