From c4185d03cfb5c4e9df4c004b2c13a9b3c3196eac Mon Sep 17 00:00:00 2001 From: thomasb 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) git-svn-id: https://svn.roundcube.net/trunk@2401 208e9e7b-5314-0410-a742-e7e81cd9613c --- .../new_user_identity/new_user_identity.php | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 roundcubemail/plugins/new_user_identity/new_user_identity.php (limited to 'roundcubemail/plugins/new_user_identity') diff --git a/roundcubemail/plugins/new_user_identity/new_user_identity.php b/roundcubemail/plugins/new_user_identity/new_user_identity.php new file mode 100644 index 000000000..75595693c --- /dev/null +++ b/roundcubemail/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