From cc97ea0559af1a92a54dbcdf738ee4d95e67d3ff Mon Sep 17 00:00:00 2001 From: thomascube Date: Sun, 19 Apr 2009 17:44:29 +0000 Subject: Merged branch devel-api (from r2208 to r2387) back into trunk (omitting some sample plugins) --- plugins/new_user_identity/new_user_identity.php | 49 +++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 plugins/new_user_identity/new_user_identity.php (limited to 'plugins/new_user_identity/new_user_identity.php') diff --git a/plugins/new_user_identity/new_user_identity.php b/plugins/new_user_identity/new_user_identity.php new file mode 100644 index 000000000..75595693c --- /dev/null +++ b/plugins/new_user_identity/new_user_identity.php @@ -0,0 +1,49 @@ +add_hook('create_user', array($this, 'lookup_user_name')); + } + + function lookup_user_name($args) + { + $rcmail = rcmail::get_instance(); + if ($addressbook = $rcmail->config->get('new_user_identity_addressbook')) { + $match = $rcmail->config->get('new_user_identity_match'); + $ldap = $rcmail->get_address_book($addressbook); + $ldap->prop['search_fields'] = array($match); + $results = $ldap->search($match, $args['user'], TRUE); + if (count($results->records) == 1) { + $args['user_name'] = $results->records[0][$rcmail->config->get('new_user_identity_field')]; + } + } + return $args; + } +} +?> -- cgit v1.2.3