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) »
  • Drupal Integration: How to get drupal username in CiviCRM export or list
Pages: [1]

Author Topic: Drupal Integration: How to get drupal username in CiviCRM export or list  (Read 2550 times)

Alan.Guggenheim

  • Guest
Drupal Integration: How to get drupal username in CiviCRM export or list
March 03, 2010, 10:15:23 am
I have hundreds of contacts in civicrm that need to be added to Drupal Organic groups. OG requires entry of a list of drupal usernames and (unfortunately) cannot accept emails.
I cannot find how to generate a list in Civicrm (or export) that includes drupal's username
Is there a way?
If not, is there a way in Drupal to generate a list of CiviCRM contacts selected by one custom field in CiviCRM? Could not find that either.
Thanks

civicrmsav

  • I post frequently
  • ***
  • Posts: 121
  • Karma: 5
  • CiviCRM version: 4.2.6
  • CMS version: Drupal 7.x
Re: Drupal Integration: How to get drupal username in CiviCRM export or list
March 26, 2010, 07:04:42 am
Hi - I needed to do the same thing and couldn't find a way to do it through the interface.  I used phpmyadmin to access the underlying data with this query which did the trick.

SELECT con.id, con.first_name as First, con.last_name as Last,  emp.organization_name as Employer, uf_name as DrupUser
FROM ((`civicrm_contact` con
INNER JOIN civicrm_contact emp on con.employer_id = emp.id)
LEFT JOIN  `civicrm_uf_match` mat on con.id=mat.contact_id)
LEFT JOIN xxxxxx.drup_users u on mat.uf_id=u.uid
where con.contact_type="individual"

Note that you need to replace xxxxxx with the name of your drupal database (assuming you have two different databases)

Hope this helps


civicrmsav

  • I post frequently
  • ***
  • Posts: 121
  • Karma: 5
  • CiviCRM version: 4.2.6
  • CMS version: Drupal 7.x
Re: Drupal Integration: How to get drupal username in CiviCRM export or list
March 26, 2010, 07:37:01 am
Sorry, minor error.  I gave you the email address not the user name.  This one has the user name

SELECT con.id, con.first_name as First, con.last_name as Last,  emp.organization_name as Employer, u.name as DrupUser
FROM ((`civicrm_contact` con
INNER JOIN civicrm_contact emp on con.employer_id = emp.id)
LEFT JOIN  `civicrm_uf_match` mat on con.id=mat.contact_id)
LEFT JOIN xxxxxx.drup_users u on mat.uf_id=u.uid
where con.contact_type="individual"

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: Drupal Integration: How to get drupal username in CiviCRM export or list
March 26, 2010, 08:54:51 pm
For alan - og user import - won't that do what you need?
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

Alan.Guggenheim

  • Guest
Re: Drupal Integration: How to get drupal username in CiviCRM export or list
March 29, 2010, 02:18:27 pm
peterd,

Yes, you were correct. Thanks. That module indeed lets us import emails instead of username. It worked great.
I wish the integration between CiviCRM and Drupal was more complete and 2 way, though. Any chance for improvements there?

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: Drupal Integration: How to get drupal username in CiviCRM export or list
March 29, 2010, 04:45:32 pm

better integration between civicrm and drupal is always beneficial to the community at large. Would be great if you / your organization members could help and contribute code to the project that improves this aspect of civicrm

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Drupal Integration: How to get drupal username in CiviCRM export or list

This forum was archived on 2017-11-26.