CiviCRM Forums
News: You can learn more about CiviCRM from our new free book: Understanding CiviCRM. Also Check the CiviCRM Blog for updated information on CiviCRM
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 02, 2010, 09:09:51 am


Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Node reference?  (Read 553 times)
gavula
I’m new here
*

Karma: 0
Offline Offline

CiviCRM: 3.1.3
CMS: Drupal 6.15
MySQL: 5.0.41
PHP: 5.2.5

Posts: 3


View Profile WWW
« on: April 01, 2010, 11:16:33 am »

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, 11:21:57 am by gavula » Logged
Donald Lobo
Administrator
I’m (like) Lobo ;)
*****

Karma: 330
Online Online

CiviCRM: 3.2
CMS: Drupal 6.x, Joomla 1.5.x
MySQL: MySQL 5.1.x
PHP: PHP 5.3.x

Posts: 9357



View Profile WWW
« Reply #1 on: April 01, 2010, 11:29:04 am »


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 Smiley

lobo
Logged

Use CiviCRM? Like CiviCRM? Then show your appreciation and make a donation.
gavula
I’m new here
*

Karma: 0
Offline Offline

CiviCRM: 3.1.3
CMS: Drupal 6.15
MySQL: 5.0.41
PHP: 5.2.5

Posts: 3


View Profile WWW
« Reply #2 on: April 01, 2010, 12: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:
WHERE contact_type LIKE 'Individual'

...the site throws a nonrecoverable error.   Undecided

However, if I change it to:

Code:
WHERE contact_type LIKE 'Organization'

...it outputs just the orgs Smiley or:

Code:
WHERE contact_type IS NOT NULL

...I get all contact types.  Grin  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, 12:49:31 pm by gavula » Logged
bob schmitt
I’m new here
*

Karma: 1
Offline Offline

Posts: 21



View Profile WWW
« Reply #3 on: July 30, 2010, 09:46:27 am »

I like this change (NOT NULL). Works well for me. Any chance it will make it into the next version?
Logged
Donald Lobo
Administrator
I’m (like) Lobo ;)
*****

Karma: 330
Online Online

CiviCRM: 3.2
CMS: Drupal 6.x, Joomla 1.5.x
MySQL: MySQL 5.1.x
PHP: PHP 5.3.x

Posts: 9357



View Profile WWW
« Reply #4 on: July 30, 2010, 05: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
Logged

Use CiviCRM? Like CiviCRM? Then show your appreciation and make a donation.
kreynen
I’m new here
*

Karma: 0
Offline Offline

Posts: 2


View Profile
« Reply #5 on: August 04, 2010, 07: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
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM