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) »
  • Views Filter contextual Arguments - provide default (Civi) value
Pages: [1]

Author Topic: Views Filter contextual Arguments - provide default (Civi) value  (Read 1812 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Views Filter contextual Arguments - provide default (Civi) value
January 28, 2013, 06:23:15 pm
When showing views as blocks or attachments you can use contextual filters & provide a default argument using such options as

- Content ID From URL
- Fixed Value
- PHP Code
- Current OG Group From Context
- User ID From URL
- User ID From logged in User

For blocks on Civi pages it would be handy to be able to grab Civi Values from the URL - eg. contact id - has anyone ever looked into this. (PHP Code is one method but not all views creators have this permission)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Views Filter contextual Arguments - provide default (Civi) value
February 02, 2013, 05:12:29 pm
Thought I would just add some context - potential from this is putting a block alongside the Contact Summary page that lists:-
- Membership Status
- Relationships of specified types
- Latest Activities of specified types
which could be a whole lot easier for Drupalers than customising TPLs

Anyone?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

millionleaves

  • I’m new here
  • *
  • Posts: 21
  • Karma: 0
    • Millionleaves
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Views Filter contextual Arguments - provide default (Civi) value
March 13, 2013, 04:17:54 pm
I have a slight twist on this.

I wanted to create an organisation member directory in Drupal that will list all member organisations. The standard approach to doing this in Civi doesn't give me enough flexibility (I want additional information and images and will give each organisation the ability to manage their own listing node). So I'm doing it by creating a content type for Organisations, and a view to list all organisations by region.

I want to include a field in the Organisation content type that will contain the contact ID for the organisation in CiviCRM - this will be manually populated. I want the Organisation listing page to have a contact card at the bottom that will contain certain information about that organisation which will be pulled from Civi using a View and contextual filter that only pulls information for the CiviCRM record that matches the contact ID field in the node..

I'm assuming that I'll need to write some PHP to query the Civi database and thereby set the Default Value in the contextual filter in the view.

Questions:
- Am I on the right track?
- Will this work?
- Is there a better way to achieve a similar outcome?

Assuming the answers are Yes, Yes and No (in that order), any suggestions for the PHP I'd need to write? I'm not a coder but can get access to someone who is IF this approach is going to work. Happy to post the PHP back once I get it working.

Thanks

David
Millionleaves - CiviCRM and Drupal services for New Zealand and the world
http://www.millionleaves.com

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Views Filter contextual Arguments - provide default (Civi) value
March 17, 2013, 02:25:29 pm
If you are linking CiviCRM contacts to Drupal nodes you should take advantage of the civicrm contact reference field type in Drupal. Once you have used that CiviCRM data about the contact should be available to views based on the node you have linked to.

You probably want to familiarise yourself with CiviCRM webform integration if you haven't already done so.

Good to see CiviCRM happening in Tauranga again!
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Views Filter contextual Arguments - provide default (Civi) value

This forum was archived on 2017-11-26.