Hi,

assume we are looking at a user/% page. I want to show a block of friends (relations) for that given user %, excluding that user. This means I need setup a contextual filter. But the contextual filters only allow "requestee" or "requester" by URL id. So it's either/or, but you need both directions.

Feature request: add a contextual filter (argument) "requestee OR requester".

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Nicolino77’s picture

I have the same request. This is important.

jessehs’s picture

This adds a contextual filter "requestor or requestee" that should allow this to be created.

You would also add a contextual filter to the view User: uid with the "Exclude" option checked in order to exclude the user from the view as well.

One caveat is that if this is a panels pane, its User: uid context can only be used for one argument in the view. To get around this, I set up the views pane's Argument Input options to be "Input on pane config" and on the pane config I set both arguments to be "%user:uid".

Note that I haven't tested, but this may depend on the patch here: https://drupal.org/node/409432#comment-8551703

jessehs’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: user_relationships-contextual-filter-1158714-2.patch, failed testing.

Nicolino77’s picture

Jessehs, can you create a patch that passes testing? Thanks for your work!

jessehs’s picture

Status: Needs work » Needs review
FileSize
3.17 KB

This patch applies against 7.x-1.x-dev. The previous patch was applied to a project that had a bunch of patches applied already (many useful ones too!) Here is a Drush Make file entry explaining all patches I had applied (including the one I posed above in #2):

projects[user_relationships][download][branch] = "7.x-1.x"
projects[user_relationships][download][revision] = "593d202"
; Machine names: https://drupal.org/node/1980610#comment-7994549
projects[user_relationships][patch][] = "https://drupal.org/files/user-relationships-machine-name-1980610-08.patch"
; Features exportable: https://drupal.org/node/691034#comment-7998557
projects[user_relationships][patch][] = "https://drupal.org/files/user-relationships-features-691034-17.patch"
; Views actions: https://drupal.org/node/409432#comment-8551703
projects[user_relationships][patch][] = "https://drupal.org/files/issues/user-relationships-views-actions-409432-169.patch"
; User permission warning: https://drupal.org/node/2194069#comment-8473565
projects[user_relationships][patch][] = "https://drupal.org/files/issues/user-relationship-hook-permissions-2194069-01.patch"
; User permission privatemsg screening connections
; https://drupal.org/node/2273647#comment-8809663
projects[user_relationships][patch][] = "https://drupal.org/files/issues/user_relationships_privatemsg_alter_hook-2273647-1.patch"
; Ignore requests rather than delete them: https://www.drupal.org/node/203364#comment-8922817
projects[user_relationships][patch][] = "https://www.drupal.org/files/issues/user_relationship-ignore-requests-203364-25.patch"
; Fix strict warning issue: https://drupal.org/node/1551792#comment-7867433
projects[user_relationships][patch][] = "https://drupal.org/files/ur-strict_warning-1551792-11.patch"
; Add not stating that only connections are valid recipients
; https://www.drupal.org/node/2289425#comment-8897297
projects[user_relationships][patch][] = "https://www.drupal.org/files/issues/connected_user_doc_warning-2289425-1.patch"
; Views contextual filter: https://www.drupal.org/node/1158714#comment-8916309
projects[user_relationships][patch][] = "https://www.drupal.org/files/issues/user_relationships-contextual-filter-1158714-2.patch"