The ability to store the defined custom fields in: ldapprov.conf.inc into the ldap using the "Basic LDAP attributes:" template

ldapprov.module Line #1588

  //Add Support for storring the custom fields into ldap
  foreach(ldapprov_custom_elements() as $field_name => $field) {
    $ldap_vars['!'.$field_name] = $data['custom_'.$field_name];
  }

I fixed it like this for the time being but is it possible to integrate this into the module or is there some other way to do this?

Comments

miglius’s picture

Issue tags: +custom fields

There is no ldapprov.conf.inc file any more in the dev version. Custom fields are configurable from the module settings page.

matt v.’s picture

Can someone provide a bit more detail on how to add custom fields? For backwards compatibility reasons, I need to add a custom salted password field to LDAP that users should not see or be able to edit. I need the salted password to be stored when a user gets created and updated if a user changes their password. I have a handle on getting the password and salting it the way I need it, but I'm not sure how/where I go about adding it to LDAP.

Nr. 18’s picture

Version: 6.x-1.0-alpha2 » 6.x-1.0-beta1

In the 6.x.-1.0-beta1 release you goto: /admin/settings/ldap/ldapprov

There you will find a fieldset: "Registration form" with "Custom elements" there you can add a custom field to the registration form:

sponsor|type=>textfield|title=>Sponsor POC|weigth=>4|size=>64|maxlemgth=>64|required=>1|description=>Sponsor Point of Contact.

And than you add the following to the "LDAP attributes"

<ldapattribute_name>: !custom_sponsor

As you can see the field called !custom_<custom name>

madhusudan’s picture

@ Nr. 18

its not working.

ldapattribute_name: !custom_sponsor

i tried some combinations
like

ldapattribute_name: %custom_sponsor
ldapattribute_name: !sponsor
ldapattribute_name: %sponsor

although its adding in ldap server with the name itself(!custom_sponsor) ,not the exact value.

I am using drupal-6.15 with ubuntu 9.10 karmic and LDAP server is a fedora version.

madhusudan’s picture

hmm i cant wait anymore.

finally got it working after digging the code .

in ldapprov.module after line number 1860 (don't know exactly but after this line )
$ldap_vars['!pass'] = $pass_ldap;

I added


$form_custom = variable_get('ldapprov_custom', array());
foreach ($form_custom as $custom_name=>$field)
{
$ldap_vars['!'.$custom_name] = isset($data[$custom_name]) ? $data[$custom_name] : NULL;
}

and it's working perfectly.

and rest is same as Nr. 18 said .

Note: I have tested only for only Custom elements which are defined in ldapprov registration form.
but was not working with Profile integration. lets see if someone can contribute that code

I hope the author will add this code in next version.! :-)

terminus’s picture

*shrug* worked for me. Maybe you didn't realise that "ldapattribute_name" is a placeholder, and that you actually have to put, um, your attribute name. For example:

o: !custom_o

vincetingey’s picture

I too was unable to get this to work for me.

Yes I double checked that I was using the correct syntax:

attribute: !custom_customfieldname

john franklin’s picture

Version: 6.x-1.0-beta1 » 6.x-2.x-dev
Issue summary: View changes
Status: Active » Fixed

The 2.x branch includes hook_ldapprov_custom_attributes_alter(&$ldap_vars, $account) so you can add entries of the form $ldap_vars['!my_custom_attribute'] from your own custom module.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.