0

I have a multisite network that's gaining in popularity, but one of the most confusing user experiences for the new client is filling in the "What do you want your site name to be?" I get everything but a properly formatted site name per WPMU site name validation rules.

To make this easier, I'm rewriting my plugin code so that the user doesn't input their own site name. Instead, it's automatically generated for them behind the scenes.

I thought it would be a no-brainer to use the blog ID of the new site since it was unique.

But, on line 623 of ms-function.php is the following code that prevents site names from being numeric only.

// all numeric?
if ( preg_match( '/^[0-9]*$/', $blogname ) )
$errors->add('blogname', __('Sorry, site names must have letters too!'));

Why would this be the case? Is this a security issue or something? I plan on creating a unique, easy to remember, name which will consist of a random word plus the blog id (for example pinecone55 where 55 is the blog id).

But, I don't want to do that if exposing the blog id in anyway has security implications.

What would be the caveats to a numeric only name or one that contains the blog ID?

1

To make this easier, I'm rewriting my plugin code so that the user doesn't input their own site name. Instead, it's automatically generated for them behind the scenes.

+1000

As with most "why is the core code like that", it is probably better to either look at GIT/SVN "blame" and hope you can find a useful comment either in the code or the commits, but AFAIR this code is ancient from the days when MS was a standalone product which will make digging reason up even harder.

Assuming there is no helpful explanation in the code, I would assume that the cause is that in the context of subdomain configuration some DNS hosts/software incompatibility, or web servers having hard time parsing it, something that is probably not true this days. For some more context read https://serverfault.com/questions/172041/numeric-subdomain

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.