I have a custom table. Inside that table I have 2 uids.

Using hook_views_data_alter I know how to make a join with users table. My field is called also "uid".

The join looks like this:

    $data['ofertas_producto']['table']['join'] = array(
        'users' => array(
            'left_field' => 'uid',
            'field' => 'uid',

    $data['ofertas_producto']['uid']['relationship'] = array(
        'base' => 'users',
        'field' => 'uid',
        'handler' => 'views_handler_relationship',
        'label' => 'Creador del Producto',

As you can see the join defined in the first array has only one possible definition with the users table and one left field inside of it. So if I want to define another join with a second field "uid_2" it will override the first declared join.

Am I right? Thanks for your knowledge.

  • It seems to me that you could find out by giving it a go?...
    – Darvanen
    Jun 9, 2015 at 13:04
  • Yes @Darvanen. I found a way that worked.. I'm just waiting for a better or more elaborated answer. Thanks. Jun 9, 2015 at 20:20
  • Have you tried adding the join with second uid too? Jun 15, 2015 at 11:30

1 Answer 1


It will not be overridden. It will be another relationship. See the example at the API docs: https://api.drupal.org/api/views/views.api.php/function/hook_views_data_alter/7

See also the example here: https://stackoverflow.com/a/11103419/2467536

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.