Join user to custom table I have a custom table (myusersession) which contains the uid field that is a reference to user entities.

How can I add user entity fields (exactly 'name') to my view?

I tried many variations of join, in hook_views_data(), but none of them works.

  $data['myusersession']['table']['join'] = array(
    'users_field_data' =&gt; array(
      'field' =&gt; 'uid',
      'left_field' =&gt; 'uid',
    ),
  );

  $data['myusersession']['uid'] = array(
    'title' =&gt; t('UID'),
    'help' =&gt; t(''),
    'field' =&gt; array(
      'id' =&gt; 'numeric',
    ),
    'filter' =&gt; array(
      'id' =&gt; 'numeric',
    ),
    'argument' =&gt; array(
      'id' =&gt; 'numeric',
    ),
    'relationship' =&gt; array(
      'title' =&gt; t('User'),
      'help' =&gt; t(''),
      'base' =&gt; 'users',
      'base field' =&gt; 'uid',
      'id' =&gt; 'standard',
    ),
  );


I also tested variations of the table name, such as users_field_data, users, and user.

As I understand the following code should be work, but it doesn't in my case.

    'relationship' =&gt; array(
      'title' =&gt; $this-&gt;t('User'),
      'label' =&gt; $this-&gt;t('User'),
      'base' =&gt; 'users',
      'base field' =&gt; 'uid',
      'relationship field' =&gt; 'uid',
    ),    


With ['table']['join'], the table appears as column on the view with User as base, but but if the view base is myusersession, User doesn't appear.
Found that there is additional step: you have to add/enable that relationship at View GUI->Advanced->Relationship