First time here? You may want to check out the blog archive, subscribe to the RSS feed, sign up for free email updates, or follow me on Twitter. Thanks for visiting!

Find and Replace Text Across DNN Modules 

DNN text/html replacement moduleHere is a little stocking stuffer for you.

Born from a recent client engagement and brought to life by our good friend Mitchel Sellers, this little utility module allows you to not only search for, but also replace any string across all text/html module instances of your DNN-based website.

In a wizard-like fashion, the module presents its search results in a table, listing the module ID, module title and a link to the page of the respective text/html module before committing any replacements to the database.

By default, the module functions in “admin-only” mode, meaning that only registered users in the DNN Administrator role have access to the module. You may however grant any other DNN user role permissions via module settings.

Please be aware that this is a powerful tool that may modify multiple database records quickly. It is important to fully understand the impact of changes across your website. As always, we strongly recommend that you backup your DNN database prior to performing any replacements.

Free download:

Module roadmap:

  • Ability to preview changes to modules
  • Ability to select specific module instances to change
  • Ability to perform replacements in text of other modules

Questions or comments? Post them below.




Comments

Vitaly Kozadayev Vitaly Kozadayev says:

I took a quick look at the module - worked perfectly! This is a very useful tool! Thank you, guys!

Tom Kraak Tom Kraak says:

Thanks Vitaly, I'm glad you found it useful.

Déclic Vidéo FX Déclic Vidéo FX says:

Should be perfect if we can use it with Apollo MLHTML (multi language module)


DV

Mitchel Sellers Mitchel Sellers says:

I am glad that individuals are finding this module helpful. DV we can possibly explore the ability to add that module in as a supported module.

If anyone has questions or is in need of assistance I have setup a dedicated forum for this module here - http://www.mitchelsellers.com/Forums/tabid/123/view/topics/forumid/19/Default.aspx

Chris Hammond Chris Hammond says:

Actually, the link you have going to the Engage: F3 module isn't accurate anymore. The F3 module does Search/Replace it was always intended to do. Thanks for the link though! -Chris

Tom Kraak Tom Kraak says:

Thanks Chris - I did notice that you added "replace" functionality to Engage: F3 recently.

Lance Lance says:

Tom (Mitch, Chris) - nice freebie!

I would pay for the module too if it had the 3 planned enhancements plus:

1) created a rollback script just before changing the database. (Find and replace is very painful to get wrong.)

2) had a regex engine to do things like move images into a new folder or strip out depreciated tags.

Of the 3, replacing content in other tables is pretty high up there for me. I had to create stored procedures to adjust Ventrian and blog modules. Much better if I could get the feed back this provides.

Jeff W Jeff W says:

Cool. So, this would be like the "permanent" version of Bruce's inline links tool, right?

Does it only work with Text/HTML modules or will it also affect articles in, say, Ventrian News Articles?

Tom Kraak Tom Kraak says:

Only works with DNN's text/html module for now.

Jonathan Jonathan says:

I tried to install this on DNN 5.1.1 and got the following warning. Is that a big deal?

Package Installation Report

See below for the results of the package installation

StartJob Starting Installation
Info Starting Installation - SC.Modules.TextReplacementTool
Info Starting Installation - Script
Info Begin Sql execution
Info Folder Created - c:\inetpub\wwwroot\DesktopModules\TextReplacementTool\
Info Created - 01.00.00.SqlDataProvider
Info Executing 01.00.00.SqlDataProvider
Info Start Sql execution: 01.00.00.SqlDataProvider file
Warning SQL Execution resulted in following Exceptions: System.Data.SqlClient.SqlException: Invalid column name 'DesktopHtml'. Invalid column name 'DesktopHtml'. Invalid column name 'DesktopSummary'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at DotNetNuke.Data.SqlDataProvider.ExecuteADOScript(String SQL) at DotNetNuke.Data.SqlDataProvider.ExecuteScript(String Script, Boolean UseTransactions) /** Create Stored Procedures **/ CREATE PROCEDURE dbo.[SC_TextReplace_SearchForReplacements] @PortalId INT, @SearchText VARCHAR(255) AS SELECT m.ModuleTitle, tm.TabId, ht.ModuleId, ht.DesktopHtml, ht.DesktopSummary FROM dbo.[HtmlText] ht INNER JOIN dbo.[TabModules] tm ON (ht.ModuleId = tm.ModuleId) INNER JOIN dbo.[Modules] m ON (tm.ModuleId = m.ModuleId) WHERE m.PortalId = @PortalId AND ht.DesktopHtml LIKE @SearchText System.Data.SqlClient.SqlException: Invalid column name 'DesktopHtml'. Invalid column name 'DesktopSummary'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at DotNetNuke.Data.SqlDataProvider.ExecuteADOScript(String SQL) at DotNetNuke.Data.SqlDataProvider.ExecuteScript(String Script, Boolean UseTransactions) CREATE PROCEDURE dbo.[SC_TextReplace_UpdateHtmlTextInstance] @ModuleId int, @DesktopHtml ntext, @DesktopSummary ntext AS UPDATE dbo.[HtmlText] SET DesktopHtml = @DesktopHtml, DesktopSummary = @DesktopSummary WHERE ModuleId = @ModuleId
Info End Sql execution: 01.00.00.SqlDataProvider file
Info Created - Uninstall.SqlDataProvider
Info Finished Sql execution
Info Component installed successfully - Script
Info Starting Installation - Module
Info Module registered successfully - SC.Modules.TextReplacementTool
Info Component installed successfully - Module
Info Starting Installation - Assembly
Info Assembly registered - bin\SC.Modules.TextReplacementTool.dll
Info Created - bin\SC.Modules.TextReplacementTool.dll
Info Component installed successfully - Assembly
Info Starting Installation - File
Info Created - ViewTextReplacementTool.ascx
Info Created - Settings.ascx
Info Folder Created - c:\inetpub\wwwroot\DesktopModules\TextReplacementTool\App_LocalResources
Info Created - App_LocalResources\ViewTextReplacementTool.ascx.resx
Info Created - App_LocalResources\Settings.ascx.resx
Info Component installed successfully - File
Info Installation committed
Info Installation successful. - SC.Modules.TextReplacementTool
Info Deleted temporary install folder
EndJob Installation successful.



Tom Kraak Tom Kraak says:

Sorry for the confusion Jonathan, but this module has NOT been tested with DNN 5 yet.

And according to the error you received, we'll have to slightly rewrite the module.

dbs dbs says:

I tried to install this but received errors, then I stepped back, and got this error message when I tried to validate the module. By the way, I'm using DNN4.9.4, so I downloaded and am trying to use "DNN text/html Find & Replace (DNN 4.5.0 and up | ajax enabled)"


Validation Results
The element 'control' has invalid child element 'supportspartialrendering'. List of possible elements expected: 'iconfile, type'.
The element 'control' has invalid child element 'key'. List of possible elements expected: 'iconfile, type'.

I appreciate any help!

Mitchel Sellers Mitchel Sellers says:

This module has not been updated to work with DotNetNuke 5.x. I will work on a new version ASAP!

dbs dbs says:

What about DNN v4.9.4?

This seems like such a basic/common requirement when moving any dnn application from a local to online server. What are the prospects of this module becoming part of the default/base set of dnn modules? Just wondering...

Thanks for your assistance. I can anticipate making a lot of use of a module in the future.

Name (required)

Email (will not be published) (required)

Website

Enter the code shown above in the box below

Subscribe to our Feeds Follow on Twitter