Is there a way in drupal that would allow each user to have their own subdomain?

Comments

agentrickard’s picture

toul’s picture

ok.
thank you for the links...
i try to figure out. i think wordpress has a function to allow user after they registered to have a subdomain or something like this: www.mysite.com/username

drupalina’s picture

subscribing

Summit’s picture

Hi,

I really would like this functionality also.
lets join forces how to solve this!
Subscribing.

Greetings,
Martijn

agentrickard’s picture

It occurs to me that the Domain Access module that I am writing could be used for this purpose.

You would need a Domain User extension module that does the following:

- On signup, lets the user (optionally) create a subdomain record. [This is easy, using hook_form_alter()].
- On content creation, force the user to be on their subdomain (so that the content is node accessed to their 'site'). [This is easy, using hook_form_alter() and domain_goto().

For this to work, your server would need to support Wildcard DNS.

--
http://ken.blufftontoday.com/
http://new.savannahnow.com/user/2
Search first, ask good questions later.

Summit’s picture

Hi,

Will you help build the Domain user extension module?
I am not a programmer, but for sure will help you with testing etc...
I see lots of people want this functionality, and your new module cuold be a great centre in this!

Greetings,
Martijn

agentrickard’s picture

I'd love for someone else to do it, but after I finish Domain Prefix, I should be able to write Domain User.

--
http://ken.blufftontoday.com/
http://new.savannahnow.com/user/2
Search first, ask good questions later.

AainaalyaA’s picture

What about mod_rewrite with wildcards? shouldn't that help in creating subdoms automatically?

AsidrA Society | www.AsidrA.com

agentrickard’s picture

mod_rewrite is important, and the uses depends on what behavior you want.

In some instances, we use mod_rewrite to redirect from user.example.com to example.com/user/UID. This works very well for some sites. See, for example http://ken.blufftontoday.com

In the case of Domain Access, we're talking about giving users an entire site to themselves at username.example.com. That will work in concert with wildcard DNS because:

a) we have a way to automate the creation of 'registered' third-level domains.
b) on each third-level domain, we can load specific themes, settings, and content (using node_access rules).

--
http://ken.blufftontoday.com/
http://new.savannahnow.com/user/2
Search first, ask good questions later.

Michelle’s picture

There are so many possibilites for this. I'm surprised I haven't seen more discussion on it.

Michelle

--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.

skizzo’s picture

this seems a promising development... and I want to be ready for it :-) so for my new site I decided to restrict characters in usernames to [a-z, A-Z, 0-9, hyphen]. Well, I would like to do that in anyway! According to http://drupal.org/node/29694 permitted characters are configurable in D4, not so in D5. I found the following in user.module but have no idea on how to further restrict the characters. Thank you for any help, and congratulations for CR Online!


function user_validate_name($name) {
if (!strlen($name)) return t('You must enter a username.');
if (substr($name, 0, 1) == ' ') return t('The username cannot begin with a space.');
if (substr($name, -1) == ' ') return t('The username cannot end with a space.');
if (strpos($name, ' ') !== FALSE) return t('The username cannot contain multiple spaces in a row.');
if (ereg("[^\x80-\xF7 [:alnum:]@_.-]", $name)) return t('The username contains an illegal character.');
if (preg_match('/[\x{80}-\x{A0}'. // Non-printable ISO-8859-1 + NBSP
'\x{AD}'. // Soft-hyphen
'\x{2000}-\x{200F}'. // Various space characters
'\x{2028}-\x{202F}'. // Bidirectional text overrides
'\x{205F}-\x{206F}'. // Various text hinting characters
'\x{FEFF}'. // Byte order mark
'\x{FF01}-\x{FF60}'. // Full-width latin
'\x{FFF9}-\x{FFFD}'. // Replacement characters
'\x{0}]/u', // NULL byte
$name)) {
return t('The username contains an illegal character.');
}
if (strpos($name, '@') !== FALSE && !eregi('@([0-9a-z](-?[0-9a-z])*.)+[a-z]{2}([zmuvtg]|fo|me)?$', $name)) return t('The username is not a valid authenti
cation ID.');
if (strlen($name) > USERNAME_MAX_LENGTH) return t('The username %name is too long: it must be %max characters or less.', array('%name' => $name, '%max' =
> USERNAME_MAX_LENGTH));
}

Michelle’s picture

Not sure if you were directing that question at me... I haven't a clue. I don't know anything about regex and what you'red doing there is completely greek to me.

Michelle

--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.

dman’s picture

Sounds like fun.

Note that wildcard DNS is a hosting thing, so you must have a co-operative ISP or lots of control over your own machine to get it sorted out. It won't work out-of-the-box (if ever) for most shared hosting environments.

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

agentrickard’s picture

Very true. But we do our own hosting.

--
http://ken.blufftontoday.com/
http://new.savannahnow.com/user/2
Search first, ask good questions later.

H3rnand3z’s picture

subscribing

MrBT’s picture

subscribing

okday’s picture

subscribing

thank you.

litebulb1’s picture

agentrickard’s picture

The Domain User module is in HEAD for Domain Access, and I expect to have a release candidate shortly.

However, Domain User is a node access module, and as such may have more overhead than most people want.

Testers will be appreciated.

--
http://ken.blufftontoday.com/
http://new.savannahnow.com/user/2
Search first, ask good questions later.