How use current user id from global $users in relationship?

Created on 27 November 2023, 7 months ago

Good day, i wrote simple code


global $user;

$data['custom_table']['custom_field'] = array(
  'title' = 'Custom field',
  'help' = 'Custom field',
  'relationship' = array(
    'base' => 'another_custom_table',
    'base_field' => 'another_custom_field',
    'handler' => 'views_handler_relationship',
    'extra' = array(
      array('field' => 'some_field', 'operator' => '=', 'value' => $user->uid),
    )
  );

Thus, I want to add a dynamic filter to the request based on the ID of the current user, but in this case it always returns 1 to me, i.e. as if the administrator is authorized in any case
How can I send the current user exactly

πŸ’¬ Support request
Status

Active

Version

3.29

Component

Views Data

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024