Move logic for converting email to username into a separate function

dww - November 6, 2009 - 22:23
Project:Email Registration
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:dww
Status:needs work
Description

It'd be nice if the default logic in email_registration_user() when no module implements hook_email_registration_name() lived in a separate helper function instead of being embedded directly into email_registration_user(). That'd make it easier to write unit tests for it, and it'd allow someone to reuse the same logic when importing users via migrate module, for example.

#1

dww - November 6, 2009 - 22:33
Assigned to:Anonymous» dww
Status:active» needs review
AttachmentSize
625734-1.email_registration_email_to_name.patch 2.55 KB

#2

greggles - November 6, 2009 - 22:49

Seems reasonable to me though I'm not sure if the abstraction should work the way it does or if it should include the call that invokes the hooks of other modules.

That is, if a site has setup a email_registration and written a hook that changes the way names are generated then I would expect that hook to be used if they called this function directly.

#3

dww - November 6, 2009 - 23:55
Status:needs review» needs work

Ahh, good point.

 
 

Drupal is a registered trademark of Dries Buytaert.