Blog

horizontal line graphic

Subscribe to Kevin Southworth's Blog  Subscribe to my RSS feed | Categories | Search

Articles from DotNetNuke

Enabling the "remember me" checkbox in DotNetNuke

Wednesday, September 17, 2008 @ 2:05 PM :: 116 Views :: 0 Comments ::

For some reason the "remember me" checkbox in DotNetNuke websites usually does not function correctly.  In fact, it does not remember you at all!

The fix is to update your web.config file.  Find the setting called PersistentCookieTimeout in the appSettings section, it's probably set to 0.  Change this to whatever value you like (in minutes).  I like 10080 to remember users for 1 week.

HowTo: Promote a regular DotNetNuke user to a SuperUser

Tuesday, September 02, 2008 @ 11:34 AM :: 139 Views :: 1 Comments ::

The other day I needed to promote a regular DotNetNuke user account to a "SuperUser" account and couldn't find any info on how to do it.  Well it turns out it's quite easy if you can run a quick SQL script on your DNN database.  Here's all it takes:

-- Promote regular user to SuperUser
declare @username varchar(50)
set @username = 'theUsernameToPromote'
UPDATE Users SET IsSuperUser = 1 WHERE username = @username
DELETE FROM UserPortals WHERE UserId = (SELECT UserID FROM Users WHERE username = @username)

Run the script above on your DNN database and whoila!

HowTo: Programmatically Hide a DotNetNuke Module

Friday, May 16, 2008 @ 10:33 AM :: 346 Views :: 0 Comments ::

I needed to programmatically hide a DotNetNuke module today and I couldn't find any examples of how to do it.  So here's how to do it.  This hides the entire module, including the container and title.

In your Page_Init method in your code-behind, use this little baby:

ContainerControl.Visible = false;

Retrieving DotNetNuke List Items in Code

Monday, September 24, 2007 @ 12:51 PM :: 542 Views :: 1 Comments ::

Today I needed to grab the contents of a DotNetNuke List (Host Settings -> Lists).  Here's the code to grab the "Country" list and DataBind it to a ListBox:

            Dim listController As New ListController

            Dim listEntries As ListEntryInfoCollection = listController.GetListEntryInfoCollection("Country")

 

            lstCountries.DataSource = listEntries

            lstCountries.DataValueField = "Value"

            lstCountries.DataTextField = "Text"

            lstCountries.DataBind()

Custom DotNetNuke Control Panels

Wednesday, January 24, 2007 @ 2:05 AM :: 445 Views :: 0 Comments ::
This is just a quick note for myself, I may do a full blog post on this topic later (since I haven''t found instructions anywhere on how to do this from anyone else).

I was interested in creating a custom control panel for DotNetNuke (the bar at the top with all the page and module functions).

  1. Create a copy of the .ascx / ascx.cs files of one of the existing control panels in the "website/admin/controlpanel" directory
  2. Add a row in the "ModuleControls" table with ControlKey = CONTROLPANEL:XXX where XXX is your custom name and set the ControlType = -3
Step # 2 should make your custom control panel visible in the Host Settings -> Advanced -> Other -> Control Panel drop-down

Using the DNN Label Edit Control

Wednesday, January 24, 2007 @ 2:00 AM :: 453 Views :: 0 Comments ::

Nice post from the core team on how to use the relatively new "DNN Label Edit" control, which is utilized in the newest versions of DNN to allow the user to just click and edit the module title in-place.  That control is available for us to re-use in our own modules, which is cool

http://dotnetnuke.com/Default.aspx?tabid=825&EntryID=1048

Custom Module permissions in DotNetNuke

Wednesday, January 24, 2007 @ 1:54 AM :: 286 Views :: 0 Comments ::

Here''s a nice post from the core team on how to implement custom module permissions for your own modules, and hooking them up to the built-in "permissions grid"

http://dotnetnuke.com/Default.aspx?tabid=825&EntryID=1052

Modifying the DotNetNuke SearchResults module

Wednesday, January 24, 2007 @ 1:48 AM :: 317 Views :: 0 Comments ::

Today I was working on a client''s website, trying to integrate an event calendar system that we have with their DotNetNuke site search.  The DNN site search input and search results are actually two different modules.  The problem is that our events system is a separate application with its own database. The challenge was to make the DNN site search include the events from our external system in the search results in such a way that visitors wouldn''t know the difference between DNN results and our event system results.  There are probably numerous ways to accomplish this, but we needed a very quick turnaround time and it had to look like it was still part of DNN.  So here''s what I did:

  1. Created a  stored procedure in the events database that would accept a "searchWords" parameter and would return the relevant rows
  2. Downloaded the "source" version of DotNetNuke 3.2.2 from the dotnetnuke website www.dotnetnuke.com
  3. Opened the VS solution file inside "\Solutions\DotNetNuke.Providers"
  4. Opened "SearchDataStore.vb" inside the "Provider.Search.DataStore" project
  5. Appended my custom search code onto the end of the "GetSearchResults" function (which starts at line 336 of the .vb file) I inserted my code right before the return statement. The basic steps for this part are:
    1. Call your stored procedure or whatever code you''re going to use to do your custom search, passing it the "Criteria" variable (provided by DNN)
    2. Loop through your results and create a "SearchResultsInfo" object for each result and add it to the "Results" collection which is of type "SearchResultsInfoCollection"

    1 // create SqlConnection, SqlCommand, SqlReader, etc.

    2 SqlDataReader reader = new SqlReader()

    3 // Fill your DataReader, other code omitted...

    4 While (reader.Read())

    5     Dim eTitle As String

    6     Dim eDesc As String

    7     eTitle = reader.GetString(4)

    8     eDesc = reader.GetString(1)

    9 

   10     Dim myResult As New SearchResultsInfo

   11     myResult.Author = "Kevin S."

   12     myResult.AuthorName = "Kevin S."

   13     myResult.Guid = "111" //fake/placholder

   14     myResult.Image = 0

   15     myResult.ModuleId = 367 //should be a real moduleId

   16     myResult.Description = eDesc

   17     myResult.Occurrences = 1

   18     myResult.PubDate = reader.GetDateTime(2)

   19     myResult.Relevance = 1000

   20     myResult.TabId = 36 // should be a real tabId

   21     myResult.Title = eTitle

   22 

   23     Results.Add(myResult)

   24 End While

You''re done!  DNN will use the info you specify for each SearchResultsInfo object to build a URL and link your search results to the Tab you specified automatically.  As you can see a lot of the values I used are just placeholders/filler in this case, since my custom search results don''t really pertain to a particular "tab" or "moduleid".  I''m sure there are more "provider-like" ways to customize the DNN search without modifying the DNN core source code, but this was the quickest way I found today :)

DotNetNuke E-Commerce / Store modules

Wednesday, January 24, 2007 @ 1:42 AM :: 292 Views :: 1 Comments ::

Why hasn''t anyone made a decent e-commerce / store module for DNN? I''ve been looking for one for about 2 months now that is easy to use (from both an admin and shopper standpoint) and has support for the popular payment processors such as Authorize.net and PayPal, and has an option for manual payment processing (just storing the credit card info for offline processing).  So far I have not found anything that satisfies all of those criteria.  The only one that comes close is the PortalStore module from www.dnn-modules.com It''s got a lot of features, but the UI is terrible and the interface is a bit clunky for both the admin and the shopper.

If I could find the time I''d sit down and write one myself, but I''m just too busy right now.  I guess I''ll have to add it to my never-ending list of projects....

DotNetNuke Module Development

Wednesday, January 24, 2007 @ 1:39 AM :: 275 Views :: 0 Comments ::
I wish someone could explain to me why the DotNetNuke module framework only allows ONE "View" control for each module.  I''m working on a module right now that needs 3 different view controls, but anytime I try to load one of the non-default (according to the module definition) view controls DNN forces the admin skin on it and I lose the other panes.  Why can''t I just load a specific view control for my module and have it keep the other panes!  aaahh!  The only solution I''ve found that other people have used is to implement a dynamic control injection scheme using the query string and a big switch statement inside their one default view control which dynamically loads other view controls as needed in-place.  Unfortunately, when you do that you lose a lot of features like module actions per view control and design time event assignments to your buttons, datagrids, etc. on each page.  Say it isn''t so!  Someone please tell me there''s a better way......