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) »
  • Node reference?
Pages: [1]

Author Topic: Node reference?  (Read 2717 times)

gavula

  • Guest
Node reference?
April 01, 2010, 12:16:33 pm
Hello,

I've been reading your FLOSS manual and testing a local install of Civi/Drupal to learn about configuration options.  I've been stuck on a question and I was wondering how other Drupal/Civi users have handled it.

Say your Drupal site has a node type called "Schools" from which you would like your Users to be able to associate themselves with.  If it were only a Drupal site I would enable the Content Profile module and add a node reference field, along with all the other User info we might want to collect like name, age, etc.

However, if our site has Civi, which already collects name, age, etc, it seems like one could almost do away with the need for Content Profile as a module.  But Civi doesn't look as if it supports node reference as a field type?  If that is right, how do Civi sites commonly create relationships between nodes and Users/Contacts?  Do you simply maintain the Content Profile Module for the node reference only?

I should also add for this use case making the School into a contact won't work as other node types may need to reference it and as far as I see the CCK Contact Reference module only allows selection among individual contacts, not organizations.  Unless I'm doing something wrong there.

Thanks so much for any insight.  Looking forward to experimenting and learning more!
« Last Edit: April 01, 2010, 12:21:57 pm by gavula »

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Node reference?
April 01, 2010, 12:29:04 pm

contact reference module should be extentded to allow you to select any contact type, not just individuals. I suspect doing this is quite easy (eliminate the where sub-clause which checks for contact_type in drupal/modules/civicrm_cck/civicrm_cck.module

In the future it would be great if custom fields were "hookable" so we could add other field types to civicrm, like node reference :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

gavula

  • Guest
Re: Node reference?
April 01, 2010, 01:26:11 pm
Thanks Lobo,

When I eliminate line 679 (I'm not really a module builder so I'm afraid I may be doing it wrong)

Code: [Select]
WHERE contact_type LIKE 'Individual'
...the site throws a nonrecoverable error.   :-\

However, if I change it to:

Code: [Select]
WHERE contact_type LIKE 'Organization'
...it outputs just the orgs :) or:

Code: [Select]
WHERE contact_type IS NOT NULL
...I get all contact types.  ;D  Look who's making modules change!

Anyway, thanks for the tip and the quick response. I'll keep plugging.

-John
« Last Edit: April 01, 2010, 01:49:31 pm by gavula »

bob schmitt

  • I’m new here
  • *
  • Posts: 22
  • Karma: 1
    • Expeditionary Information Systems
Re: Node reference?
July 30, 2010, 10:46:27 am
I like this change (NOT NULL). Works well for me. Any chance it will make it into the next version?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Node reference?
July 30, 2010, 06:06:47 pm

bob:

wanna clean up the code base for that part, file an issue and attach the patch. Ideally we should eliminate the contact_type clause completely (i briefly tried to trace the code but did not succeed)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

kreynen

  • I post occasionally
  • **
  • Posts: 105
  • Karma: 8
Re: Node reference?
August 04, 2010, 08:43:06 am
I needed both a contact field and an organization field so I cloned the civicrm_cck module into a new module.  If you are going to update civicrm_cck, please keep this use case in mind. 

http://www.openmediaproject.org/sites/default/files/civicrm_org_cck.zip

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Node reference?

This forum was archived on 2017-11-26.