iFinity Blogs 

Creating Vanity User Urls in the new User Profile Page in DotNetNuke 5.3 with Url Master

Mar 29

Written by:
Monday, March 29, 2010 8:20 PM  RssIcon

One of the new features you’ll find in the recently released DotNetNuke 5.3.1 version is the ‘User Profile’ page.  This page is created by default in new installations, and is part of the continual move towards more ‘social’ features in the DotNetNuke core.

The new User Profile page contains details from the existing DotNetNuke user profile, and includes the new messaging system newly built into the DNN core.

User-Profile-Page

Shown Above : DotNetNuke 5.3.1 User Profile Page

Vanity User Urls

It’s a funny term, ‘Vanity’ Urls, but it denotes the use of a short, simple Url, usually based around a username of some type which shows the details or home page of the user.

Examples are:

http://www.twitter.com/brucerchapman – My Twitter home page

http://au.linkedin.com/in/brucechapmansoftwaredeveloper – My LinkedIn home page

People like Vanity Urls for the same reason they like any Friendly Url – it indexes well in search engines, it’s easy to read and you could conceivably put it on the bottom of a business card without freaking out a designer.

However, the standard DotNetNuke Url for the user profile page isn’t exactly in this category.  Here’s a screenshot of my User Profile page on my development machine:

Note : platypus/dnn530 is the portal alias of this particular test site

User-Profile-Url-DNN

Not exactly a Vanity Url out of the box.  But all is not lost, there’s a quick and easy solution!

Using the latest release of the Url Master module (1.15.4) you can also quickly and easily set this up for your DotNetNuke User Profiles page.

Here’s the close-up of the Url from the above screenshot:

User-Profile-Url

You’ll notice that there is no reference to a tabid, user profile page, user Id or anything, really.  Just a short, sweet Vanity Url.  This example uses the ‘Display Name’ from the User profile.  You can also elect to use the ‘username’ – but some site owners like to keep these confidential for security reasons.  You can also get rid of the .aspx if you like : a quick tick of the option ‘Never use Page Extensions’ in the Url Master configuration, and the .aspx is gone as well:

user-profile-url-no-aspx

There – a full, twitter-like Vanity Url in DNN!

There’s more : the hyphen separating the two names in the full display name is taken from the Url Master settings.  As such, this can be
anything you like, including a + space encoding.  You can also force the Urls to lower case if that’s what you’d like.

Lastly, if you’ve gone and had all your existing, unfriendly Urls indexed in a search engine, all of the /userprofile/tabid/42/userid/15/default.aspx Urls can be automatically redirected to the new, simple Urls like /bruce-chapman.

Step by Step Procedure for Creating Vanity Urls in DotNetNuke

Step 1 : Make sure you’re on DotNetNuke 5.3.1.  You’ll have to upgrade sooner or later, so might as well do it now.

Step 2 : Make sure you’ve got iFinity Url Master 1.15.4 (or later).   If you haven’t got this yet, why not download the latest version, install it and get yourself a free trial licence?

Step 3 : Check you’ve got a User Profile page setup on your site.  If it’s a new 5.3.1 install, it will be created for you.  If it’s an upgrade, you’ll have to check to make sure the ‘User Profile’ page got created during the upgrade.

Step 4 : Go to the Admin-Page Urls page to configure the User Profile Urls:

user-profile-settings

Within the Admin-Page Urls page, follow these steps:

  1. Select the ‘User Profile’ page in your portal
  2. Change the ‘User Profile Rewrite on:’ option to say ‘This Page’.  This configures the User Profile Page as the page loaded when a user profile Url is requested.
  3. Choose what the User url will be based on, either ‘username’ (the logon name of the users) or ‘Display Name’ (which the users fill out).
  4. Type ‘userid’ in as the ‘User Id Parameter Name’.  This value is taken from the original Url, and shows what querystring keyname is used to supply the value of the User Id in a request (the original Url rewrites to /default.aspx?tabid=42&userid=15 from /userprofile/tabid/42/userid/5/default.aspx)
  5. If you have existing user profile urls indexed by a search engine, or perhaps bookmarked by existing users, then check the ‘redirect old profile urls’.  If this is a new site, you probably don’t have to worry.
  6. Click ‘Apply Changes’ when you are done.  Note that the Url Master module must be active in order for the changes to work.  You’ll see a message on this page if it isn’t.

Step 5 : Click on the Display Name shown in the standard Logon/logoff skin object.  You will be taken to the user profile page, using the ‘vanity Url’.

Handling Special Cases

The alert reader will have a couple of questions in their head by now, something like;

- Display names are not unique, and can contain invalid Url characters.  How is this handled?

- What about if a user picks the same name as one of my pages?

- How about if the user changes their username or Display Name?

In the first two cases (non-unique Display Names, invalid characters, or page naming clash) the Url Master module will detect this and output a slightly less friendly Url – if there were two ‘Bruce Chapmans’ in this particular portal, the first will get /Bruce-Chapman and the next will get /userid/66/Bruce-Chapman.  The presence of the ‘66’ (assuming that is the user id) will ensure that the correct user profile gets loaded.

When there are invalid characters, the system also falls back to including the Userid/xx value in the Url, and the same thing occurs if there is a page name / username or Display Name clash.

If a user changes their username or Display Name, then the old value is going to return a 404.  There’s not much that can be done about this at this point, because there is no username/Display Name history kept in DNN, so it’s impossible to tell once a name is changed.  I believe this will be a very minor problem in most cases.

Give it a go!

So, to recap, all you need is:

- DotNetNuke 5.3.1

- Url Master 1.15.4 (or later)

- A trial licence for Url Master if you’re trying it for the first time

… and let me know via the comments if you had success!

Tags:
Categories:
Location: Blogs Parent Separator Crafty Code

2 comment(s) so far...


Gravatar

Re: Creating Vanity User Urls in the new User Profile Page in DotNetNuke 5.3 with Url Master

Bruce

Any chances of including this in the Friendly URL Provider too?

By Mark C on   Monday, October 18, 2010 11:36 AM
Gravatar

Re: Creating Vanity User Urls in the new User Profile Page in DotNetNuke 5.3 with Url Master

@mark : no, this won't be in the friendly url provider - by design the friendly url provider has no sql component to it (it uses the standard DNN database access). The user profile feature requires separate database tables, data provider and installation scripts, which aren't in the friendly url provider.

By Bruce Chapman on   Monday, October 18, 2010 11:48 AM

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel