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 »
  • Pre-installation Questions (Moderator: Dave Greenberg) »
  • How to link Drupal user and CiviCRM contact
Pages: [1] 2

Author Topic: How to link Drupal user and CiviCRM contact  (Read 12461 times)

hwdornbush

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 0
How to link Drupal user and CiviCRM contact
August 28, 2007, 06:11:50 pm
I have been investigating CiviCRM for use with a Drupal web site for a non-profit organization.  We want to be able to collect donations, and to have people register for events.  CiviContribute and CiviEvent look like they can fulfill the requirements.

I need to be able to capture basic information on those who donate and register for events, such as name, address, phone, email, amount, date.  From my testing so far, it looks like I could set up custom fields for these items, and when someone donates or registers for an event, they would fill in these fields.  This should work, but it doesn't take advantage of CiviCRM's contacts.

Can I link a user's Drupal account and CiviCRM contact information, since the contact account is set up in CiviCRM when a user gets a Drupal account?  Can I require people to provide certain information such as name and address when they sign up for a Drupal account, and have that information populate their CiviCRM contact information?  Drupal's Profile capability lets me set up these fields, but I don't want to duplicate what is in CiviCRM contacts.  This would provide a way for them to enter the information one time, and use it when they return for a future donation or event.

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: How to link Drupal user and CiviCRM contact
August 28, 2007, 06:44:29 pm

Check:

http://wiki.civicrm.org/confluence/display/CRMDOC/Profiles+Admin

on how to link civicrm and drupal registration using profiles. name/address/phone/email etc are standard CiviCRM fields and you dont need custom fields for that. Check

http://wiki.civicrm.org/confluence/display/CRM/CiviCRM+Screencast

for an explanation of custom data (more screencasts coming soon)

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

hwdornbush

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 0
Re: How to link Drupal user and CiviCRM contact
August 29, 2007, 10:51:54 am
Thanks for the documentation pointer.  It got me started.  It comes, oh, so close to actually documenting what I wanted to know, but stopped just short of it.  So here is my attempt to fill in the missing piece.  Please comment if I have stated anything inaccurately.

Linking to Built-in Contact Edit Form(s)

The original says "Refer to your Drupal or Joomla documentation for information on creating links and menu items."

I say: For Drupal:

If you create a CiviCRM Profile and select Used for: User Registration and View/Edit User Accounts,

then this CiviCRM Profile will appear as part of the Drupal user registration form and whenever the user views or edits her/his Drupal account.  Fields that you mark as required will be required for user registration and when editing accounts.  Note that if this CiviCRM Profile is added after a user account has been created, then the CiviCRM Profile fields will be blank and the user will not be required to complete those fields when he/she next edit his/her user account.

You can select User Registration and the CiviCRM Profile will be used for user registration only.  You must also select View/Edit User Accounts if you want the Drupal user to view and edit the CiviCRM Profile later when viewing his/her Drupal account. 

(Personally, I don't know why someone would want to capture the fields for user registration and not view/edit them later, as this provides a great opportunity for the user to update all the fields at the same time, as they will see them whenever they logon to Drupal.  But perhaps some prefer to not constantly re-display the profile.)

As a separate note, what is the norm for this sort of documentation update?  Should I have updated the documentation wiki?  Asked for permission?  or just used the forum?
« Last Edit: August 29, 2007, 10:53:29 am by hwdornbush »

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: How to link Drupal user and CiviCRM contact
August 29, 2007, 12:07:19 pm

Thanx for your contribution. Please edit the documentation on the wiki directly. The wiki is version controlled etc, and we keep track of changes and fix if needed.

Note that an org might decide to collect basic information during registration (to make registration a shorter process), but collect more detailed information with a different set of profiles in the view/edit my account



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

hwdornbush

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 0
Re: How to link Drupal user and CiviCRM contact
August 29, 2007, 02:01:12 pm
OK, I will add to the wiki.

I have one more question which may seem basic, but I am still at a basic level. 

Most of CiviCRM seems aimed at the user who is managing the contact information of others for the organization.  I would like to allow the users who have Drupal accounts to manage their own CiviCRM contact information, which might be more than what I have exposed in the Drupal user record through the CiviCRM profile.  I don't see a Drupal access control for the CiviCRM module that allows a Drupal user to maintain his/her own CiviCRM contact record.  I don't want to expose all contact records, but just that user's record.  It would also be nice to give them access to other personal information, such as their donation and event records.  How can I do this?

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: How to link Drupal user and CiviCRM contact
August 29, 2007, 02:56:27 pm

Check the User Dashboard feature of CiviCRM where we expose group memberships/contributions/event registration etc. You will need to enable permissions in drupal etc:

http://demo.civicrm.org/drupal/civicrm/user?reset=1

Contact editing per user is only possible via profile

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

hwdornbush

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 0
Re: How to link Drupal user and CiviCRM contact
August 29, 2007, 05:14:18 pm
"You will need to enable permissions in drupal etc:"

After trying many combinations of Drupal permissions, I still don't have it working.  For authenticated users, I enabled:
Access CiviCRM
Access contact dashboard
Access all custom data
Profile listings and forms

I have CiviCRM Menu and CiviCRM Shortcuts blocks enabled.

I added a menu item, "My dashboard," to the Drupal Navigation menu: http://my.org/civicrm/user?reset=1 to match what I should need for http://demo.civicrm.org/drupal/civicrm/user?reset=1

When I login as an authenticated user, I don't see the CiviCRM shortcuts block.  I do see menu items for "CiviCRM" and "My dashboard."  When I select CiviCRM, I see the CiviCRM home page, but the only options are "Find Contacts" and "Manage Groups."

When I click Find Contacts and search for any contacts, I get No Matches Found.  I don't have any groups, so that menu items correctly says I have no groups.  I don't see the dashboard link in the CiviCRM menu.

When I click "My dashboard" which is linked to http://my.org/civicrm/user?reset=1, it takes me to http://my.org/civicrm/dashboard?reset=1

At the top of the CiviCRM Home page, I see a box Recently Viewed: with this user's email address.  If I click on it, I see the CiviCRM contact record.  If I click on "View contact dashboard," I can see the user dashboard.  If I click the Edit button, I get an error "you do not have access."

So I am thoroughly confused.  The link that should take me to the dashboard takes me to the CiviCRM Home page.  The link there takes me to the contact record summary, where I can link to the dashboard.

What Drupal permissions should be sufficient so that an authenticated user can access the user dashboard?

Why does the civicrm/user?reset=1 link take me instead to civicrm/dashboard?reset=1 (which is apparently the CiviCRM dashboard and not the user dashboard)?


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: How to link Drupal user and CiviCRM contact
August 29, 2007, 06:21:08 pm

That is quite surprising :( You only need: "Access contact dashboard" permissions for auth users to get this to work. I just tried this on my local sandbox and it seemed to work fine

Can u do the foll:

1. Let us know what version of php / civicrm / drupal u r using
2. can u enable ALL permissions for authenticated user and see if it works (i suspect it will)
3. can u disable them one at a time, and see when it stops working

thanx

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

hwdornbush

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 0
Re: How to link Drupal user and CiviCRM contact
August 29, 2007, 08:24:04 pm
I am using Drupal 5.2, PHP 5.2.2, CiviCRM 1.8.10954

I enabled all Civicrm permissions, and all appear.

I started disabling permissions.  In order to have the Contact Dashboard appear, I must have enabled:
Access CiviCRM
Access CiviContribute
Access Contact Dashboard
Edit groups

In the contact dashboard, I see Groups and Contributions.

If I disable Access CiviCRM, I get Access Denied
If I disable Access CiviContribute, I see the dashboard but there are no contributions listed.
If I disable Contact Dashboard, I see the CiviCRM menu but there is no item for the dashboard.
If I disable Edit Groups, I see the CiviCRM menu but there is no item for the dashboard.

Unfortunately, I must have Access CiviContribute enabled for contributions to be listed on the dashboard, but this also causes CiviContribute to be on the menu and to expose overall contributions, which would not be acceptable.

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: How to link Drupal user and CiviCRM contact
August 29, 2007, 09:34:33 pm

I could not reproduce this locally. I'll ask someone else to try and reproduce this on their local install

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

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: How to link Drupal user and CiviCRM contact
August 30, 2007, 01:00:52 am

Can u give auth user the following permissions and see if that works (i'm pretty sure it will!)

access Contact Dashboard   
make online contributions
register for events
Access all custom data
Profile listings and forms

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

hwdornbush

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 0
Re: How to link Drupal user and CiviCRM contact
August 30, 2007, 09:42:01 am
Sorry, no.  I had tried that combination before I started posting in this topic.  I just tried it again.  The menu item that I added, "My Dashboard" mapped to http://my.org/civicrm/user?reset=1, no longer appears in the menu.

I tried adding Access CiviCRM, and now CiviCRM shows up, and "My Dashboard" shows as mapped to civicrm/user%3Freset%3D1 when I login as my test authenticated user.

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: How to link Drupal user and CiviCRM contact
August 30, 2007, 12:00:30 pm

Sorry, at this point in time i'm a bit lost and not sure why your install behaves the below way. We've tried to reproduce it locally and not succeded.

If you a PHP developer, you might want to try tracing the code and figuring out whats happening and why

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

catya

  • I’m new here
  • *
  • Posts: 17
  • Karma: 0
Re: How to link Drupal user and CiviCRM contact
May 22, 2008, 07:58:50 am
Did you ever sort this out?  I'm running to the same problem and looking for an answer.

hwdornbush

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 0
Re: How to link Drupal user and CiviCRM contact
May 22, 2008, 09:34:51 am
No, I never got any further in resolving it.  I am just learning to develop so I haven't traced the code.  The nonprofit decided to continue using another service for their database, so Drupal + CiviCRM is used to collect donations and events contributions, but the accounting is in another system.

There is still the fundamental problem, imho, that the CiviCRM fields are marked as required but they really aren't until the user edits the account after the account is created, which is too late for me.

CiviCRM is still a great tool for some purposes.  I use it on two sites, and will probably use it on more.

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Pre-installation Questions (Moderator: Dave Greenberg) »
  • How to link Drupal user and CiviCRM contact

This forum was archived on 2017-11-26.