CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Views3 contextual filter for CiviCRM contact reference field
Pages: [1]

Author Topic: Views3 contextual filter for CiviCRM contact reference field  (Read 7626 times)

linkx

  • I post occasionally
  • **
  • Posts: 86
  • Karma: 7
Views3 contextual filter for CiviCRM contact reference field
June 05, 2013, 12:44:47 pm
I have a view of Drupal nodes with CiviCRM contact reference fields with a block display that shows on my civicrm contact pages (such as /civicrm/contact/view?reset=1&cid=1). I want to create a contectual filter (argument) that will "Provide default value" of CiviCRM contact ID so that my results are filtered based on the contact record page that the view block is displayed on.

Simply: I want a list of referencing nodes displayed in a block on the page of each CiviCRM contact record.

I know this can be done using "Provide default value" > "PHP code" and returning the contact record using the CiviCRM API. How?

I hope this discussion leads to a nice resource for others, as this is a common use-case for views integration. Thank you.

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Views3 contextual filter for CiviCRM contact reference field
June 05, 2013, 01:39:29 pm
Each contact record page has the contact id in the URL.
If views can't just take it directly from the url, then use php code like this:
Code: [Select]
return $_GET['cid'];
Try asking your question on the new CiviCRM help site.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Views3 contextual filter for CiviCRM contact reference field

This forum was archived on 2017-11-26.