Closed (outdated)
Project:
Email Registration
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
23 May 2014 at 13:43 UTC
Updated:
23 Jul 2025 at 18:17 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
subhojit777Hello, here is the patch that provides an UI to configure username pattern. If hook for constructing username not found, then this patch checks if setting exists for username pattern, and constructs username as per setting. I guess this will be as an added feature in this module, because users would like to provide username patterns in UI rather than writing code.
Comment #2
gregglesThis looks decent to me. Any chance you can write a test?
Comment #3
subhojit777Sure. I have not written tests before. I saw that there is a
email_registration.testinside the module, shall I include my test case inside that, and submit that as patch?Comment #4
gregglesYes, that would be great, thanks.
If you prefer to submit it as a behat test that would be fine too (I find those easier to write - especially when leveraging the Drupal extension).
Comment #5
subhojit777Hello greggles,
Here is a patch with test case included. The test does: create a new user, then check whether the username matches a defined username pattern. I guess the test should check this. Have I missed anything else? I found writing tests using simpletest easy, so did not wrote tests in behat test.
Also I found that one of your test is failing "By default, username can log in.". And also the assertion messages are enclosed within t(), even though we should not do that https://drupal.org/node/265828. I guess the corrections should be done in another issue. I can help in this case if I get time :)
Comment #6
System Lord commentedI would like to jump in here and offer any testing I can. I've been looking for something like this. I never liked any part of my user's email address exposed. No matter how much information i provided my users that they should change their username less than 1% ever did. Now, with this I can simply make it default to: User_1234. Very nice! This is so important to me that I'm already using this on my live site.
So....
I've installed this and made the pattern: User
I'm using D731
So far "User_1234" seems to be showing up everywhere it should...display name, privatemsg, comments, content author, and emails. It doesn't seem to be changing existing usernames, which is good.
I'm a little concerned with your (subhojit's) comment...
I really don't know enough about coding/patching to help with that, and I haven't experienced any conflicts yet, but I would like to see this patch finalized and committed. I'm prepared to help in anyway I can...test and such.
Thank you for this patch!!!!
Mark
Comment #7
subhojit777@Mark the reason you are not seeing user id in the username, because username is set before the user is created, and at that moment the user object does not have the user id.
You could set something else, for example use first name and last name combination as pattern to set username.
Or you can do this, use rules to alter username to user_[user_id] after user is created.
I would prefer the first approach :)
Comment #8
System Lord commentedI do not collect names of users, so "User_????" is perfect. When I say "User" I mean actually using the word "User" as the the actual set pattern not as a token. My concern (before this patch) was that this module (I think its this module) would append the first part of the user's registered email address to "_[UID]" making it "[email]_[UID]". And now I don't have to worry about that :)
My other concern (after the patch) is your comment
I'm not sure what you mean. I've done testing and my user's cannot login with their username, which is the way I like it and they way i have it set in admin/config/people/accounts.
The bottom line for me is that I like this patch and wouldn't change a thing.
Comment #9
System Lord commentedComment #10
subhojit777I am telling about simpletests. We write simpletests to check whether features if certain module is working or not.
And as I gave here in this link, https://drupal.org/node/265828 we should not use t() functions to enclose assertion texts.
Thats what I said in comment #5
Comment #15
subhojit777Comment #16
andypostLGTM, would be great to have screenshots
just nitpick
Comment #17
bluegeek9 commentedDrupal 7 is End of Life. We recommend upgrading to a supported version of Drupal.