From 8660a74501de5ee206f6c14246f7112e6ea91ad3 Mon Sep 17 00:00:00 2001 From: till Date: Sat, 20 Mar 2010 14:20:01 +0000 Subject: moved plugins git-svn-id: https://svn.roundcube.net/trunk@3394 208e9e7b-5314-0410-a742-e7e81cd9613c --- plugins/new_user_identity/new_user_identity.php | 47 +++++++++++++++++++++++++ 1 file changed, 47 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..43eeae9dd --- /dev/null +++ b/plugins/new_user_identity/new_user_identity.php @@ -0,0 +1,47 @@ +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]['name']; + } + } + return $args; + } +} +?> -- cgit v1.2.3