DNN Foum - Make "My Settings" open to new window 

In the last month or so i was working on some modifications to the DotNetNuke forums module to meet some of their customers needs regarding usability. One of these items was to make the "My Settings" link open in a new window rather than moving the user from their current viewing page. This is a small modification that I thought was quite helpfule so I thought I would share the steps necessary to make the change.

Requirements:

To make these changes you must have Visual Studio 2003 and the source code for the 3.2.8 or 3.2.9 versions of the DotNetNuke Forums module.

Disclaimer:

The following code snippets are provided as an example and you MUST take caution to determine if this code is correct within your specific instance of the forum module source code. Please note, that before replacing the default code that you will want to make note of any "alignment" specifications that were completed in the origional code.

The Files:

To perform this change on the "My Settings" link in all locations you must modify the following files:

  • \Components\Groups\ForumGroup.vb
  • \Components\Moderate\ForumModerate.vb
  • \Components\Post\ForumPost.vb
  • \Components\Search\ForumPortalSearch.vb
  • \Components\Search\ForumThreadSearch.vb

The Change:

Even though you must modify 5 individual files, the change is actually very simple, you will modify the exact same method in each of the files, you will simply be adding a conditional flag to the process that builds the navigation menu. Below is the signature of the method that you will be looking for each time.

Private Sub RenderNavBar(ByVal wr As HtmlTextWriter)

Inside this method for each file you will find a loop similar to the following:

For Each Action As ModuleAction In ForumControl.NavigatorActions
    RenderCellBegin(wr, 
"Forum_NavBarButton"""""""""""""' <td> 
    
RenderLinkButton(wr, Action.Url, Action.Title, "Forum_Link")
    RenderCellEnd(wr) 
' </Td>
Next

This code simply iterates through a list of navigation actions and builds the hyperlink. We will simply be adding a quick if statement in there to change the render tag portion for the link to open in a new window if we are linking to the "UserSettings" control. Below is an example of the modified loop statement.

For Each Action As ModuleAction In ForumControl.NavigatorActions
    
'Start of tag - Default
    
RenderCellBegin(wr, "Forum_NavBarButton"""""""""""""' <td> 

    'Determine if we need to have the target blank
    
If (Action.Url.IndexOf("usersettings") > 0Then
        
RenderLinkButton(wr, Action.Url, Action.Title, "Forum_Link"""True)
    
Else
        
RenderLinkButton(wr, Action.Url, Action.Title, "Forum_Link")

    
End If

    
'Render end tag - Default
    
RenderCellEnd(wr) ' </Td>
Next

If you look at this code it is a very simply comparison that is being made then a slight modification to the default "RenderLinkButton" method. One thing to not is that depending which file you are modifying the first line inside the loop might be slightly different as some of the code files specifically set CSS clas values. If you integrate a solution such as this to each of the above listed files you will then be able to have the "My Settings" page come up in a new window.

Building and Deploying

Once you have completed the changes on all code files it will be time for you to create the installation package. Before you create the installation package ensure that you have built a NEW RELEASE copy of the .dll file for the module. To actually create the install package I simply recommend downloading the "forum install package" from the DotNetNuke website then simply replacing your new .dll file. As this is the only deployable change that you made.

Overall I find this a fairly easy fix that can make the core forum module (in its current version) more user friendly. If you have any questions/concerns please let me know. I will try to build and publish a modified version of the forum with this change in the near future.

Posted by Mitchel on Thursday, July 19, 2007
 

Comments

Name (required)

Email (required)

Website

CAPTCHA image
Enter the code shown above:

Content provided in this blog is provided "AS-IS" and the information should be used at your own discretion.  The thoughts and opinions expressed are the personal thoughts of Mitchel Sellers and do not reflect the opinions of his employer.

Friend of RedGate

www.datasprings.com - DotNetNuke ModulesICG

Click here for advertising information.

Content in this blog is copyright protected.  Re-publishing on other websites is allowed as long as proper credit and backlink to the article is provided.  Any other re-publishing or distribution of this content is prohibited without written permission from Mitchel Sellers.