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 stylerepublic on
Can someone tell me why the below code wouldn't be working in my Views filter? I'm trying to accomplish the following:
Show all content of this type if field_targetuser matches logged in user id, but ALSO show all content where field_universal = YES, regardless of what appears in the targetuser id (the logged in user).
global $user;
if($user->uid == $data->field_targetuser || $data->field_universal == "yes")
{
return false;
} else {
return true;
}
I'm currently pasting it into Filter Criteria > Global: PHP
Comments
need some tweaks and debugs
You need to make sure $data is a object.