Hello folks,
I was wondering if there's a way to have Drupal automatically alias the URL for a user's blog when they sign up. We're working on a site that could potentially have thousands of users, and manually doing it would be unproductive. Of course we'd like it to go from
http://www.site.com/blog/1
to
http://www.site.com/blog/username
or just
http://www.site.com/username
Also, it would be great if the blog post titles could aliased so that instead of
http://www.site.com/joe/1
we have
http://www.site.com/joe/my-summer-vacation
I just wanted to check to see if anyone knows how to do this before I hire someone to make a cron job or something. I'd like to have it be a module so that other people could use it too. If anyone can help, even with the best way go about it, I'd be happy to send a few bucks via PayPal.
Comments
conf_url_rewrite()
i think this may be accomplished by defining a new conf_url_rewrite() function(). see the admin docs for URL aliasing
this may be true, but that fu
this may be true, but that function doesn't work with 4.5... :(
good idea. this would be nice
good idea. this would be nice. I wish I knew anything about regular expressions, so I could try the conf_url_rewrite rules.
One this to be aware of, is that users can change their usernames in default Drupal. (but then again, I think we need a way to turn this off)
Okay, I wrote this...
Here you go, this will do it: Mass URL. It's a module that does just what you want, at least for the user names.
The project page isn't completely set up yet, but you can get the module from CVS.
Note: I'm not sure if this is the best way to do all this. I'd think the conf_url_rewrite() function in conf.php would be a better way, but since it is horribly broke in 4.5, and doesn't appear to be getting fixed anytime soon, this will have to do. Also, conf_url_rewrite() doesn't seem to be able to handle more than one rewrite rule, so it's limited there too. Actually, Drupal needs more customization abilities for paths, but it doesn't seem to be a priority, and it's out of my coding league...
Thanks wazdog!
This is very nice. I have been looking for this module for a long long time.
Update: I think I have found one rather nasty bug regarding User related URLs.
http://drupal.org/node/13233