I get the following error after updating to 6.x-1.x-dev (2011-Aug-17). Last Version (Aug-10) worked for me.

warning: array_fill() [function.array-fill]: Number of elements must be positive in /usr/local/www/drupal6/sites/all/modules/ldap_integration/ldapdata.module on line 242.
warning: implode() [function.implode]: Invalid arguments passed in /usr/local/www/drupal6/sites/all/modules/ldap_integration/ldapdata.module on line 242.

My findings:
A function call changed from
221: $profile_fields = _ldapdata_retrieve_profile_fields();
to
239: $content_profile_fields = _ldapdata_retrieve_content_profile_fields();

Thats why the next command fails, since $profile_fields is not defined.
242: $placeholders = implode(',', array_fill(0, count($profile_fields), "'%s'"));

When i change the whole line 239 back to the previous version, everything works. As i dont use the content profile module, i cannot say how this works.

CommentFileSizeAuthor
#7 profile_fields_missing-1253020-7.patch525 bytescgmonroe

Comments

mweixel’s picture

I do use Content Profile, so I'm glad to see the beginnings of support for that module. The problem is that Content Profile stores the various parts of its related node part in a collection of CCK tables. ldapdata.module wants to use the traditional profile_fields tables as it tries to figure out what fields in the profile are dates.

It looks like the change to include Content Profile was started but not finished. Would it be possible to have _ldapdata_retrieve_content_profile_fields return the full array of arrays describing all of the Content Profile fields--including their type--and then just process any date fields in the profile based on that info? I can't think of any other way to do it, since there isn't a single table to query.

sutharsan’s picture

Duplicated by #1280458

sutharsan’s picture

Is error prevents the LDAP Data module from being used with the Profile module. The fix by superhenne enables the use of Profile module, but prevents the use of Content Profile module. :(

johnbarclay’s picture

A patch for this should include either a user interface for selecting profile vs. content profile or automatically use content profile if its installed. The patch to ldapdata.module should work with either.

johnbarclay’s picture

I also add this to the list at: http://drupal.org/node/1237378#comment-4833068

cgmonroe’s picture

FYI - The "correct" fix for this is not to replace the line with the old one as the top level entry describes. But to ADD this line back in. E.g.:

Old:

$content_profile_fields = _ldapdata_retrieve_content_profile_fields();

New:

$profile_fields = _ldapdata_retrieve_profile_fields();
$content_profile_fields = _ldapdata_retrieve_content_profile_fields();

This will enable both standard profile field support and (limited) content profile support. By limited, I mean it supports "R/O" operations where the content profile fields can be mapped to LDAP attributes... e.g. users can change Content Profile node fields, but next "sync" will reset them to LDAP values. Doesn't seem to support updating LDAP attributes when profile fields are changed.

cgmonroe’s picture

Status: Active » Needs review
StatusFileSize
new525 bytes

Here's a patch against the current head that adds in the missing line.

This will work with any combination of profile/content_profile modules. The functions called to populate the two *profile_fields variables already check if the appropriate module is enabled. In addition, the handler code below the patch already checks if the variables are set.

cgmonroe’s picture

Status: Needs review » Closed (duplicate)

Marking this as a duplicate of:

#1400154: Ldapdata module support for updating LDAP attributes from Content Profile Nodes

Which has a larger patch that fixes this and other problems related to content_profile support.

cgmonroe’s picture

Assigned: Unassigned » cgmonroe

Since this issue keeps the -dev version from working, the missing $profile_fields... line and some conditionals were committed.

Note that this is a small part of the the larger #1400154: Ldapdata module support for updating LDAP attributes from Content Profile Nodes code that still needs to be reviewed.