I've got the ldap_integration module up and running on my test Drupal site, and it's happily checking the users credentials against the directory and snagging all sorts of useful user information (names, titles, email, etc.)
What I'm trying to figure out how to do is to get it to populate the "mail" field in Drupal's "users" database when a new user (who exists in LDAP) logs into Drupal for the first time. Right now that field only gets updated if someone visits and then saves their user profile (not a likely occurance). It does pre-populate the form's e-mail field, so the data's there, but it's just not in Drupal yet.
I've been slowly going over the code, but haven't found a good place to insert such a hack yet. Any suggestions?
Ken
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | ldap_integration.module-correctMapping | 32.58 KB | pablobm |
Comments
Comment #1
pablobm commentedOoops. My fault, as usual. I forgot to update the line that does that job when I worked out the Drupal/LDAP mappings.
I'm having problems to access CVS at the moment, so I post here a solution for your problem. The change is in the function
_ldap_integration_ldap_login(), towards the end of the file.Comment #2
NukeHavoc commentedawesome -- I'll try that out ASAP.
Thanks!
Comment #3
pablobm commentedComment #4
tclineks commentedChanges should be posted as unified diffs for review.
Read drupal.org/patch for more
Comment #5
2root4u commentedI was also having this issue and your code fix helped. Another issue I had was the mapping in conf.php. For AD users (not sure about other LDAP setups), it would be useful to change the default conf.php from:
to
This would have definitely saved me some time.
Comment #6
pablobm commentedThere's an attribute mapping interface now, so this is not relevant anymore.
Thus, I PabloBM hereby declare this issue... Fixed
Comment #7
(not verified) commentedComment #8
oliveaddict commentedHello
Using ldap_integration 4.6.0 (10/10/2005 and 07/04/2006), the mail column in the users table is not being populated when a user logs in for the first time. Through Drupal, viewing "my account" shows the correct field under "Email", but the database cell is empty.
To test, I deleted some users, turned on query logging for MySQL and watched for the INSERT statement when the user was created. The 'mail' field passed is empty.
I am using ActiveDirectory 2003 with the following settings for mail in conf.php
ldap_drupal_mappings: 'mail' => 'mail'
ldap_attributes: 'mail' => array('mailto', 'textfield', t('Email'), 64, 64, '')
Any thoughts? Thank you.
Comment #9
oliveaddict commentedIn ldap_integration.module, if I change:
to:
... then, the email field gets written to the 'users' table during the new user INSERT. I realize this is an ugly hack and would rather pull the data from $ldap_drupal_mappings. I do not see LDAP_EMAIL_ATTRIBUTE anywhere else in the code.
Am I missing something?
Thank you
Comment #10
pablobm commentedAfter a long time in oblivion, I checked this bug and seems to be fixed.
Comment #11
(not verified) commented