The user module seems to prohibit multiple users from having the same email address.
...
else if (db_num_rows(db_query("SELECT uid FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) {
form_set_error('mail', t('The e-mail address %email is already taken.', array('%email' => theme('placeholder', $edit['mail']))));
}
...
While most folks have their own emails now (some, like me, have a dozen or more), there are still a significant number of people who share email addresses - members of a single household, for example. Sometimes there are also valid reasons for an individual to have more than one userid (i.e. for different roles) - so insisting that users have unique email addresses seems unduly restrictive.
As far as I can see (at least in the user module) there's nothing to preclude this, other than somebody making an 'executive decision' not to allow it sometime along the way. It doesn't look like the email is being used as a constraint in the database - so my question is, basically, is there a problem in removing the code in 'user' that checks for dup. emails?
Thanks ...
Comments
good question..
I've often wondered the same...i.e. whether it will have a domino effect on other parts of Drupal..such as password reminders etc.
I guess if there are two people using the same email address it might cause problems when one of them is looking for their password reminder..using their email.
While I don't have an answer for you - I don't know the innards of Drupal well enough - but, I imagine that codes is there for a valid reason.
Dub
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
using same email for creating test-users
I, for instance, wanted to created multiple 'test' users with the same email to spare hassle.
And this restriction upon email re-use is a bit of a problem.
Maybe it should be handled with more flexibility.
I wonder how its done?
In the db, the field is unique, or in the code?
lets take a peek in the db* (see bellow)
ok, does not look 'unique' to me
hence it may be in the code?
hence admin could reserve him/herself
a privilage of breaking the rule
then there is the question of password reminder
which could be upgraded in a way to
take into account also username
because now it does not?
username, yes, can be changed, but is
'unique' in db so at a time there can
only be one user of a name
anyway , an interesting question
*mysql> describe users;
+-----------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+-------+
| uid | int(10) unsigned | | PRI | 0 | |
| name | varchar(60) | | UNI | | |
| pass | varchar(32) | | | | |
| mail | varchar(64) | YES | | | |
| mode | tinyint(1) | | | 0 | |
| sort | tinyint(1) | YES | | 0 | |
| threshold | tinyint(1) | YES | | 0 | |
| theme | varchar(255) | | | | |
| signature | varchar(255) | | | | |
| created | int(11) | | | 0 | |
| changed | int(11) | | MUL | 0 | |
| status | tinyint(4) | | | 0 | |
| timezone | varchar(8) | YES | | NULL | |
| language | varchar(12) | | | | |
| picture | varchar(255) | | | | |
| init | varchar(64) | YES | | | |
| data | longtext | YES | | NULL | |
+-----------+------------------+------+-----+---------+-------+
17 rows in set (0.00 sec)