Hi!
I'm developing my very first Drupal module, so I'm probably doing something wrong... or else I just found a bug. Hope you can help me find out what I might have done wrong. :)
My module is supposed to populate certain values from LDAP to the user's profile upon each login, not doing authentication as opposed to the ldap_integration module. (I'm going to use it alongside with the webserver_auth module.)
The problem is that user_save doesn't do anything for me, except for when the user doesn't have an LDAP entry... then it generates a new entry into the users table in the database (but not containing any useful info of course).
<?php
// $Id$
/*
simpldap module
Populates certain values from LDAP to the user's profile upon each login,
hence this is not an authentication module (such as the much more complex ldap_auth module).
(a bit of code stolen from: http://drupal.org/node/111768 )
*/
function simpldap_user($op, &$edit, &$account, $category = NULL) {
global $user;
if ($op == 'login') {
$ldap_server = 'ldap://ldap.arcada.fi/';
$ds=ldap_connect($ldap_server);
if ($ds) {
$user_name = $user->name;
$r=ldap_bind($ds);
// TODO - What to do if user doesn't exist?