Friday, July 04, 2008     | Register
Oct 22

Written by: Rodney Joyce
10/22/2007

Scenario: The core DotNetNuke Forum module (4.4.3) has it's own limited user profile system built into it. We already use the Smart-Thinker UserProfile to display templated views of the core profile data.

 

Aim: To remove the Forums user profiles and redirect all views to the Smart-Thinker UserProfile module, so the user is provided with a single user interface and more pleasing browsing experience.

 

Note: Due to the fact that the core forums do not yet provide templating on signatures and post views, we need to make use of a URL rewriter to achieve this. Hopefully one day it will be possible to expose the UserID in the core Forums and then this will be a lot simpler. We used the Snapsis PageBlaster module to achieve this. You can purchase it here (Smart-Thinker customers can obtain 25% off by entering "SmartThinker" in the coupon code field).

 

Live Demonstration: Go to the Poker Forums on PokerDIY (you do not need to log in). At the top level view, click on a name under a post (right hand side), or drill into a post and click on the name on the upper left hand side (next to the Online indicator). You will notice that you are taken to the Smart-Thinker UserProfile view, and not the standard core UserProfile view. On the Smart-Thinker UserProfile, you will notice that there is a link next to the user's profile pic called "View all Forum Posts" which shows you the posts made by this user on the forums. This is a simple template tweak in the UserProfile module as described here.

 

Implementation: As mentioned above, you will need to have the Snapsis PageBlaster module installed. We will assume you have it up and running at this point. We will also assume that you have the Smart-Thinker UserProfile module installed and configured correctly, so that you can view profiles from the Events, Groups, User Directory or other modules.The first thing you need to do is to obtain the URL for a user's profile.

 

For example, on PokerDIY, my profile URL is:
http://www.pokerdiy.com/Home/PokerPlayerProfile/tabid/391/ID/1/Default.aspx

 

Bear in mind for SEO benefit you want to make sure your Profile URLs are all consistent, so that when I view a profile it always is in the form:
http://www.pokerdiy.com/Home/PokerPlayerProfile/tabid/391/ID/[USERID]/Default.aspx

 

where [USERID] is the UserID of the profile I am viewing (mine is 1 in the example above). The rest of the URL is static and should not change. Secondly, you need to capture the existing URL for the forum's old Profile page. Go to your site and click on the user's name like you did on PokerDIY and you should see the old forum's profile page (with number of posts etc.). Grab the URL and save it somewhere for later.

 

For example, on the core DotNetNuke site, a forum profile links to:
http://www.dotnetnuke.com/Community/Forums/tabid/795/ctl/UserProfile/mid/2108/userid/63971/Default.aspx

 

 

Now that we have the URL, we need to instruct the PageBlaster module to dynamically replace any occurrence of the old request for the new one. We can do this by setting up a rule. The online help and Snapsis site go into great detail on how this works (and their product support is really impressive), so we will not cover the operation of the PageBlaster module here. Add the PageBlaster module to the Forums page and create a new rule for it.

 

We called ours "Forum UserProfile" and it has the following params:

Search For:
"PokerForums/tabid/\d+/ctl/UserProfile.*?/userid/(\d+)/.*?Default.aspx"
Replace With:
Home/PokerPlayerProfile/tabid/391/ID/$1/Default.aspx

 

Regex expressions are also beyond the scope of this post, but basically PageBlaster will scan the source for any instance that matches the "Search For" string (the old profile view) and replace it with the new one, which you will see is based on our Smart-Thinker UserProfile URL (http://www.pokerdiy.com/Home/PokerPlayerProfile/tabid/391/ID/[USERID]/Default.aspx). You will need to adjust these two params to the corresponding URLs on your site.Once you have saved that, all future requests should now redirect to the Smart-Thinker UserProfile module, and we have achieved our aim.

 

Active Forums integration (and any other module that exposes the UserID)
I have not personally used ActiveForums, but if there are any templates that expose the UserID then it is very simple to link to the Smart-Thinker UserProfile module. For example, if there is a signature area that exposes the UserID token, then all you need to do is find the URL of your UserProfile module and replace the UserID with the UserID token provided by the module:
http://www.pokerdiy.com/Home/PokerPlayerProfile/tabid/391/ID/[USERID]/Default.aspx (note, I am not sure of the ActiveForums token syntax - you need to change [USERID] with the appropriate ActiveForums UserID token). If you use ActiveForums you can read more about that here.

 

For example, in the new core HTML module, you can now use Token replacements to expose the logged on User (see Mitchel Sellers' blog for more info on how to do this, or see Stefan Cullmann's blog for more info on Token replacement and syntax). So if you wanted to display a link to the logged on user, you could add an HTML module and make it viewable by Registered User's only (you need the UserID, so anonymous users will not work). You can then do something like this: My Profile

 

The logged on user can then see how their profile appears to other users.

 

Conclusion
As you can see, with tokens and the Smart-Thinker templating system there is not much that you cannot do!

 

Thanks to Ivan (Smart-Thinker customer) and John Mitchell for providing the idea and helping making this functionality possible. Thanks to Crispy and the core Forum team for all the hard work on the Forums module.

 

Please note that you can download free, fully functional trials of the Smart-Thinker modules to test them on your own website. Let us know on the Smart-Thinker forums if you require help configuring them like PokerDIY or want to discuss this post (please do not post in the Comments section).

 

Next blog post: How to integrate Ventrian's NewsArticles module to display the Smart-Thinker UserProfile picture; have a look at this poker article on PokerDIY for an example.

Tags:
© 2008 Smart-Thinker   |  Privacy Statement  |  Terms Of Use