Hi Larry,
Don't know how relevant this is, but we're in the process of writing some code around controlling user-names here as well for another SSO module (CAS). So my head is really around this problem right now.
For SSO solutions, we're implementing a username transformation hook in the sso module, which I know will not work for you (at least I don't think). But when using SSO solutions such as opened or cas are used, I've always been bothered that we create a user account before it's been approved in the registration process.
This is similar to the code in the LDAP module, but we're using a hook based approach to make it easier for other module developers to tie into. Given that, I don't think LDAP or CAS has the right solution for you.
Here's an idea for a module pattern that might work:
1. User the form_alter hook to change the field '#type' of the username to 'value' for the user_name form on a module.
2. Use the profile module to add the extra fields to the form.
3. In the form-alter hook, add form level validation fields to make sure that the generated username is unique, or guarantee uniqueness via some algorithm.
The implementation is left as an exercise for the user :). Does that approach make sense?
Dave
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Larry Garfield Sent: Thursday, March 13, 2008 2:00 AM To: support@drupal.org Subject: [support] Forcing username pattern
Hi folks. I've a question that's come up on a number of my sites now. I'd like to be able to disallow users from selecting their own usernames, ever, even on signup. Instead, I want to expose various profile fields (or custom fields via form-alter if necessary) and then base the username off of that. E.g., first intial and last name, all lower-case. Does anyone know of an existing module or mechanism for that, or a common pattern that could be
turned into a module?