I've been looking into the ldapdata.module file (ldapdata_user_profile_load function) and I spot code that seems to want to integrate with the user profile module.

But - I can't find any info on howto - and I can't seem to figure it out.

So - for example - I'd like to get the ldap CN into a profile field called Full Name. Reason for this is so that the gallery integration can then use the CN as the users full name since the gallery module links to the profile module for this.

How do I configure this?

I've tried matching the profile column name and the ldapdata name (called the field column "cn" in the profile) - but - the profile field is not getting populated.

Oh - one other question - will fields that are thus synced show up in the user under both LDAP data and the profile data ?

Comments

rblomme@drupal.org’s picture

Component: Documentation » Code
Status: Active » Needs review

I change line 325 of the ldapdata.module
db_query("UPDATE {profile_values} SET value = '%d' WHERE fid = '%d' AND uid = '%d'", $value, $fid, $uid);
into
db_query("UPDATE {profile_values} SET value = '%s' WHERE fid = '%d' AND uid = '%d'", $value, $fid, $uid);
(replace %d with %s) and it works.

// $Id: ldapdata.module,v 1.1.4.5 2006/08/20 10:35:14 pablobm Exp $

chrissearle’s picture

Hmm

I'll give it a go - but - just to mention it:

I have

// $Id: ldapdata.module,v 1.1.4.4 2006/08/05 13:05:13 pablobm Exp $

Line's around 325

    322     // does the user have a value for this field ? then update it : otherwise create it
    323     $result = db_fetch_object(db_query("SELECT value FROM {profile_values} WHERE fid = $fid AND uid = $uid"));
    324     if ($result) {
    325       db_query("UPDATE {profile_values} SET value = '$value' WHERE fid = $fid AND uid = $uid");
    326     }
    327     else {
    328       db_query("INSERT INTO {profile_values} (value, fid, uid) VALUES ('%s', %d, %d)", $value, $fid, $uid);
    329     }

Anyhow - I switched out line 325 with your new one - still not working.

Take for example - I have an LDAP record with the field telephoneNumber in it.

I'd like this in the profile field called "Telephone".

Exactly which part of the profile field needs to match telephoneNumber? Is it the database column name or the name or ?

Nemo34’s picture

Category: support » bug
Status: Needs review » Active

I noticed a annoying bug in profile LDAP mapping.

If the name pf the profile field is to long, you get this message when saving the ldapdata parameter
for the second time:

user warning: Duplicate entry 'ldap_drupal_reverse_mappings-profile_publication' for key 1 query: INSERT INTO variable (name, value) VALUES ('ldap_drupal_reverse_mappings-profile_publications_majeures', 's:0:\"\";') in /www/drupal/includes/database.mysql.inc on line 120.

I solved my problem by giving shorter names to my profile fields mbut recommend our geniuses to
update the corresponding code some day

Anonymous’s picture

Priority: Normal » Critical

I'm bumping this up to critical... rblomme's change fixes this, and without it every single profile match will be set to 0, which is a pretty big problem...

pablobm’s picture

Assigned: Unassigned » pablobm

Hi guys. Just wanted to mention that the bug mentioned in comment #1 is solved now (already commited). The rest of this will follow shortly.

pablobm’s picture

Status: Active » Needs review

Ok, this should be fixed now. I changed the was mappings are stored, but I also retained back compatibility, so there should be no problems updating.

I commited the fix to CVS.

cpfarhood’s picture

I have a current version of the ldapdata.module file but it's still not mapping correctly to the drupal profile fields, it also doesn't show what the current mapping is in the text boxes corresponding to the drupal fields when you bring up the ldapdata settings page.

pablobm’s picture

Ugh... try now, please

Libra’s picture

I have installed last version (from 05.11) - all works is fine. Thanks for your work! But there is one moment - when the user updates the profile and leaves empty fields optinal to filling we receive an error: warning: ldap_mod_del () []: Modify: Invalid syntax in ldap_integration\ldap_integration\LDAPInterface.php on line 170

kreaper’s picture

Assigned: pablobm » kreaper
Status: Needs review » Postponed (maintainer needs more info)

Is this still a problem ?

chrissearle’s picture

Running:
// $Id: ldapdata.module,v 1.1.4.9 2006/11/04 18:53:03 pablobm Exp $

All seems to work for me :)

kreaper’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)