From 5fec6de4216883e625d7e166f862985d00c99d4a Mon Sep 17 00:00:00 2001 From: thomascube Date: Sat, 27 Nov 2010 14:09:03 +0000 Subject: Copy plugins to release branch --- plugins/new_user_identity/new_user_identity.php | 50 +++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 plugins/new_user_identity/new_user_identity.php (limited to 'plugins/new_user_identity') 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..ecdf7c137 --- /dev/null +++ b/plugins/new_user_identity/new_user_identity.php @@ -0,0 +1,50 @@ +add_hook('user_create', 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]['name']; + if (!$args['user_email'] && strpos($results->records[0]['email'], '@')) { + $args['user_email'] = idn_to_ascii($results->records[0]['email']); + } + } + } + return $args; + } +} +?> -- cgit v1.2.3